Author |
Message
|
Vamsi Krishna |
Posted: Tue Aug 05, 2014 8:46 pm Post subject: Unable to Access XML element from xml file with headers |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
Hi,
Iam creating an error handler sub flow for catching exceptions in that iam
trying to access the xml file from Variables Message-> XMLNSC->TransOrder
Iam trying to acess cmrref which was highlighted below in esql
I wrote the code in esql DECLARE ID CHARACTER InputRoot.XMLNSC.TransportOrder.calloffData.cmrRef;
It is working in java but not in esql
but iam unable to see the value in ID please help me how to slove it
 |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Aug 05, 2014 10:08 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Ok, so the java works and the ESQL does not.
Put a trace node after the JCN and get it to display ${Root.XMLNSC}.
Then take a user trace
Do the same for the Compute node where you have the ESQL.
Compare the results. it could be very illuminating.
IMHO, a usertrace is far more usable in these cases than the debugger. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Wed Aug 06, 2014 12:38 am Post subject: |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
smdavies99 wrote: |
Ok, so the java works and the ESQL does not.
Put a trace node after the JCN and get it to display ${Root.XMLNSC}.
Then take a user trace
Do the same for the Compute node where you have the ESQL.
Compare the results. it could be very illuminating.
IMHO, a usertrace is far more usable in these cases than the debugger. |
In the trace the both are same the value is not inserting in the character |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Aug 06, 2014 1:23 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Vamsi Krishna wrote: |
In the trace the both are same the value is not inserting in the character |
Are the namespaces the same? Would you care to share a bit of the traces here? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Wed Aug 06, 2014 1:48 am Post subject: |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
smdavies99 wrote: |
Vamsi Krishna wrote: |
In the trace the both are same the value is not inserting in the character |
Are the namespaces the same? Would you care to share a bit of the traces here? |
It is from ESQL
( ['xmlnsc' : 0x2044dc0]
(0x01000400:XmlDeclaration):XmlDeclaration = (
(0x03000100:Attribute):Version = '1.0' (CHARACTER)
(0x03000100:Attribute):Encoding = 'UTF-8' (CHARACTER)
)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:TransportOrder = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:xsi = 'http://www.w3.org/2001/XMLSchema-instance' (CHARACTER)
(0x03000102:NamespaceDecl):xmlns = 'uri:com.transwide.comm/twFormat/calloff/v13' (CHARACTER)
(0x03000100:Attribute )http://www.w3.org/2001/XMLSchema-instance:type = 'TransportOrder' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:version = 'V13' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:event_time = '2014-07-18T16:14:12+02:00' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:sequence = '002805' (CHARACTER)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:contact = (
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:firstName = 'Format' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:lastName = 'notification' (CHARACTER)
)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:customField = (
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:name = 'shippedDateTime' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:value = '2014-07-18T23:80:00+01:00' (CHARACTER)
)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:carrierSelection = 'SHIPPER' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:carrierAllocation = 'MANUAL' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:action = 'UPDATE' (CHARACTER)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:calloffData = (
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:express = 'false' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:calloffRef = 'TA' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:cmrRef = 'TA' (CHARACTER)
This is from Java compute Node
( ['xmlnsc' : 0x2047390]
(0x01000400:XmlDeclaration):XmlDeclaration = (
(0x03000100:Attribute):Version = '1.0' (CHARACTER)
(0x03000100:Attribute):Encoding = 'UTF-8' (CHARACTER)
)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:TransportOrder = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:xsi = 'http://www.w3.org/2001/XMLSchema-instance' (CHARACTER)
(0x03000102:NamespaceDecl):xmlns = 'uri:com.transwide.comm/twFormat/calloff/v13' (CHARACTER)
(0x03000100:Attribute )http://www.w3.org/2001/XMLSchema-instance:type = 'TransportOrder' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:version = 'V13' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:event_time = '2014-07-18T16:14:12+02:00' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:sequence = '002805' (CHARACTER)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:contact = (
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:firstName = 'wFormat' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:lastName = 'notification' (CHARACTER)
)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:customField = (
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:name = 'shippedDateTime' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:value = '2014-07-18T23:80:00+01:00' (CHARACTER)
)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:carrierSelection = 'SHIPPER' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:carrierAllocation = 'MANUAL' (CHARACTER)
(0x03000000:PCDataField )uri:com.transwide.comm/twFormat/calloff/v13:action = 'UPDATE' (CHARACTER)
(0x01000000:Folder )uri:com.transwide.comm/twFormat/calloff/v13:calloffData = (
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:express = 'false' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:calloffRef = 'TA' (CHARACTER)
(0x03000000:PCDataField)uri:com.transwide.comm/twFormat/calloff/v13:cmrRef = 'TA' (CHARACTER) |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Aug 06, 2014 4:56 am Post subject: Re: Unable to Access XML element from xml file with headers |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vamsi Krishna wrote: |
I wrote the code in esql DECLARE ID CHARACTER InputRoot.XMLNSC.TransportOrder.calloffData.cmrRef;
|
This ESQL *path* has no *namespaces* in it. |
|
Back to top |
|
 |
JosephGramig |
Posted: Wed Aug 06, 2014 9:06 am Post subject: |
|
|
 Grand Master
Joined: 09 Feb 2006 Posts: 1244 Location: Gold Coast of Florida, USA
|
Ctrl+space will invoke the code assist in ESQL. |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Wed Aug 06, 2014 6:10 pm Post subject: Re: Unable to Access XML element from xml file with headers |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
mqjeff wrote: |
Vamsi Krishna wrote: |
I wrote the code in esql DECLARE ID CHARACTER InputRoot.XMLNSC.TransportOrder.calloffData.cmrRef;
|
This ESQL *path* has no *namespaces* in it. |
I had used the namespaces too but i did'nt get the value
DECLARE xs NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
DECLARE ns NAMESPACE 'uri:com.transwide.comm/twFormat/calloff/v13';
DECLARE ID CHARACTER InputRoot.XMLNSC.ns:TransportOrder.calloffData.cmrRef; |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 06, 2014 8:17 pm Post subject: Re: Unable to Access XML element from xml file with headers |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Vamsi Krishna wrote: |
mqjeff wrote: |
Vamsi Krishna wrote: |
I wrote the code in esql DECLARE ID CHARACTER InputRoot.XMLNSC.TransportOrder.calloffData.cmrRef;
|
This ESQL *path* has no *namespaces* in it. |
I had used the namespaces too but i did'nt get the value
DECLARE xs NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
DECLARE ns NAMESPACE 'uri:com.transwide.comm/twFormat/calloff/v13';
DECLARE ID CHARACTER InputRoot.XMLNSC.ns:TransportOrder.calloffData.cmrRef; |
Shouldn't it have been (according to your trace):
InputRoot.XMLNSC.ns:TransportOrder.ns:calloffData.ns:cmrRef; ?
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Wed Aug 06, 2014 9:41 pm Post subject: Re: Unable to Access XML element from xml file with headers |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
Vamsi Krishna wrote: |
mqjeff wrote: |
Vamsi Krishna wrote: |
I wrote the code in esql DECLARE ID CHARACTER InputRoot.XMLNSC.TransportOrder.calloffData.cmrRef;
|
This ESQL *path* has no *namespaces* in it. |
I had used the namespaces too but i did'nt get the value
DECLARE xs NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
DECLARE ns NAMESPACE 'uri:com.transwide.comm/twFormat/calloff/v13';
DECLARE ID CHARACTER InputRoot.XMLNSC.ns:TransportOrder.calloffData.cmrRef; |
Hi I figured out i used anonymous Field references and got the value and used the namespaces with it worked for me thanks to all of you |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Wed Aug 06, 2014 9:48 pm Post subject: Re: Unable to Access XML element from xml file with headers |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
fjb_saper wrote: |
Vamsi Krishna wrote: |
mqjeff wrote: |
Vamsi Krishna wrote: |
I wrote the code in esql DECLARE ID CHARACTER InputRoot.XMLNSC.TransportOrder.calloffData.cmrRef;
|
This ESQL *path* has no *namespaces* in it. |
I had used the namespaces too but i did'nt get the value
DECLARE xs NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
DECLARE ns NAMESPACE 'uri:com.transwide.comm/twFormat/calloff/v13';
DECLARE ID CHARACTER InputRoot.XMLNSC.ns:TransportOrder.calloffData.cmrRef; |
Shouldn't it have been (according to your trace):
InputRoot.XMLNSC.ns:TransportOrder.ns:calloffData.ns:cmrRef; ?
Have fun  |
Hi fjb_saper your code too worked for me. before i am not much familiar with namespaces well now i can use it thank u once again |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Aug 06, 2014 10:28 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Using namespaces (not anonymously) is part and parcel of being a broker developer.
Think about how you would try to create an output message tree using anonymous namespaces.
there is a wonderful function that will help you navigate message trees with complex namespaces. This is
FIELDNAMESPACE
It allows you to extract the namespace of the next (or defined) element in the tree.
Usertrace output also identifies which element in a complex path is failing.
Very useful to get familar with. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|