Author |
Message
|
kbsiva |
Posted: Mon Jun 29, 2009 7:35 am Post subject: Reading XML message from a queue using java in message broke |
|
|
 Newbie
Joined: 29 Jun 2009 Posts: 6
|
I am fairly new to message broker. I have a flow A which basically has an java compute node sending XML data to the queue via an MQOutPutNode. Do I have to set the MQRFH2 header for the messages I am dropping in?
I can see my xml data in the queue which is well formed and valid. The problem starts in the second flow which reads from this queue using an MQInputNode and then there is a java compute node which process this message. The java compute node gives a null value when I try this,
inmessage.getRootElement.getElementByFirstPath("FIL_NM");
The queue does have data like this,
<FIL_NM>abc.txt</FIL_NM>
Any suggestions to debug or any pointers on this , thanks in advance! |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jun 29, 2009 9:38 am Post subject: Re: Reading XML message from a queue using java in message b |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kbsiva wrote: |
Do I have to set the MQRFH2 header for the messages I am dropping in? |
If you don't, you'll need to provide default parsing data.
kbsiva wrote: |
Any suggestions to debug or any pointers on this |
First step in any WMB problem is a user trace. I suspect in this instance the message hasn't been parsed as XML (see my comment above).
The user trace will tell the tale.
As an aside, if all you're doing is a simple transformation and output, you may find ESQL quicker & easier than Java. It's certainly more efficient for this sort of thing. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Tue Jun 30, 2009 12:20 am Post subject: Re: Reading XML message from a queue using java in message b |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
Vitor wrote: |
The user trace will tell the tale.
|
I think a trace node with ${Root} may be more helpful in this situation but I second your other points.
Last edited by WMBDEV1 on Tue Jun 30, 2009 12:52 am; edited 1 time in total |
|
Back to top |
|
 |
er_pankajgupta84 |
Posted: Tue Jun 30, 2009 12:34 am Post subject: |
|
|
 Master
Joined: 14 Nov 2008 Posts: 203 Location: charlotte,NC, USA
|
I believe your structure of the flow would be...
MQInput -> Java Node -> MqOutput. And most probably you have not done any parsing on the MQInput node.
Try adding the XML parser on the MQInput node otherwise blob message will enter in the java node and we cannot run XPath functions on blob message. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 30, 2009 2:47 am Post subject: Re: Reading XML message from a queue using java in message b |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBDEV1 wrote: |
Vitor wrote: |
The user trace will tell the tale.
|
I think a trace node with ${Root} may be more helpful in this situation but I second your other points. |
IIRC a user trace still shows the parser in use (or not) but a trace node never hurts when you're debugging.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 30, 2009 2:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
er_pankajgupta84 wrote: |
Try adding the XML parser on the MQInput node |
You of course mean the XMLNSC parser, rather than the XML parser retained for compatibility only. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
gs |
Posted: Tue Jun 30, 2009 2:53 am Post subject: |
|
|
 Master
Joined: 31 May 2007 Posts: 254 Location: Sweden
|
A user trace sounds like a little too much work for the task. Why not just put a breakpoint after the MQInput node and run a debug session to view the logical message structure? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 30, 2009 3:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
gs wrote: |
A user trace sounds like a little too much work for the task. Why not just put a breakpoint after the MQInput node and run a debug session to view the logical message structure? |
Not a fan of the debugger personally - I always find it easier to use the trace. Couple of quick commands & you're there. Maybe I'm getting old....
....you also get more info for your money with trace IMHO. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kbsiva |
Posted: Tue Jul 14, 2009 2:24 pm Post subject: Thanks! |
|
|
 Newbie
Joined: 29 Jun 2009 Posts: 6
|
Guys,
Thanks for all the help. I have it working now. I used the debugger, it shows the OutAssembly and if you do not have the headers set then it will show as null. I prefer that since it shows you the whole message structure.
Appreciate it.
Siva |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 14, 2009 4:00 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Vitor's right. The debugger is a useful tool for diagnosing many problems, but it should not be your only diagnosis tool.
The debugger only shows you *what* is happening.
User trace tells you *why* it is happening. |
|
Back to top |
|
 |
|