Author |
Message
|
KIT_INC |
Posted: Wed Jan 07, 2009 11:03 am Post subject: Save a copy of the Input |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
In the document 'Reducing memory usage in WebSphere Business Integration Message Broker' (http://www.ibm.com/developerworks/websphere/library/techarticles/0505_storey/0505_storey.html) there are some code fragments as follow:
-- Copy the input tree, backed by the bitstream, to the environment
-- Set a message pointer to this copied message tree
SET Environment.Variables.InputRoot = InputRoot.XML;
DECLARE InMessageCopy REFERENCE TO Environment.Variables.InputRoot;
-- Shortcuts to our input and output message
DECLARE InputMessage REFERENCE TO InMessageCopy
I normally store the entire InputRoot using ASBITSTREAM if I need to save my input message. I am curious if I can get the same result like what is suggested in here.
I have a simple flow MQINPUT-COMPUTE-MQOUTPUT
MQINPUT is just use XMLNS for my input XML message.
I put the above esql in compute node and run in debug mode
SET Environment.Variables.InputRoot = InputRoot.XML;
DECLARE InMessageCopy REFERENCE TO Environment.Variables.InputRoot;
DECLARE AA CHAR;
SET AA= InMessageCopy.MY_MESSAGE.AA.A1.aa1;;
DECLARE BB CHAR;
SET BB= InMessageCopy.XML.MY_MESSAGE.AA.A1.aa1;;
The Input message is
<MY_MESSAGE><AA><A1><aa1>12345</aa1></A1></AA><MY_MESSAGE>
But all I have on the debug/variables screen is just
Environment
.Variables
and nothing under it.
Variable AA and BB are not set either.
This seem to tell me that
SET Environment.Variables.InputRoot = InputRoot.XML;
is not working.
Did I miss something? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 07, 2009 11:22 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Two things.
One: Do not use XML or XMLNS domains.
Two: Use Create Field... DOMAIN to associate the correct parser with the Environment tree. |
|
Back to top |
|
 |
KIT_INC |
Posted: Wed Jan 07, 2009 12:07 pm Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Sorry, my careless mistake. I used XMLNS parser on Input and I use XML in my esql. The code is working. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 07, 2009 2:38 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Glad you got it working. Slightly concerned that you
a) automatically used InputRoot.XML without thinking it was strange
b) have not responded to mqjeff's first point.
If you are creating a new message flow then you should be using XMLNSC ( unless you can give a good reason why not ). |
|
Back to top |
|
 |
j.f.sorge |
Posted: Thu Jan 08, 2009 5:20 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
If you use InputRoot.XML it would be better to use InputBody. Then you can change the parser, but have not to change the code. _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 08, 2009 5:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
...it would be better to use InputBody. Then you can change the parser, but have not to change the code |
I know what you mean. What you really mean is
Quote: |
...it would be better to use InputBody. Then you can change the parser, but have not to change the ESQL paths which refer to input fields |
InputBody can be useful, but a change of parser almost always requires some code changes. |
|
Back to top |
|
 |
KIT_INC |
Posted: Mon Jan 12, 2009 8:31 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Hi Kimbert, you said
Glad you got it working. Slightly concerned that you
a) automatically used InputRoot.XML without thinking it was strange
b) have not responded to mqjeff's first point.
You have been very helpful. Thanks once more for reminding me. I should always keep in mind that XML is deprecated. I was too fast on just doing a cut and paste from the document (http://www.ibm.com/developerworks/websphere/library/techarticles/0505_storey/0505_storey.html) which has the SET Environment.Variables.InputRoot = InputRoot.XML statement. I did use XMLNS in my Input Node anf that's what my problem was (not always on alert that I should not use XML) |
|
Back to top |
|
 |
kimbert |
Posted: Mon Jan 12, 2009 8:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I did use XMLNS in my Input Node... |
Good...that's a lot better than the XML domain. But still...why not XMLNSC? It is faster than XMLNS, it offers validation, and it is likely to get the best support from IBM now and in the future. Why not use it? |
|
Back to top |
|
 |
|