| Author | Message | 
		
		  | gagan.maverick | 
			  
				|  Posted: Fri Jan 29, 2016 3:22 am    Post subject: XML with Soap |   |  | 
		
		  | Acolyte
 
 
 Joined: 30 Sep 2014Posts: 50
 
 
 | 
			  
				| Hi Guys i have a message whose structure is <?xml version="1.0" encoding="UTF-8"?>
 -<soapenv:Envelope xmlns:glob="http://sap.com/xi/APPL/Global2" xmlns:urn="urn:amarfood:ERP:Global" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">-<soapenv:Body>
 <Nmamaam>
 <MessageHeader>
 
 
 Now the comes in mqinput node whose parser is XMLNSC i have selected , but not able to access MessageHeader filed.
 
 Any suggestions.
 
 I tried this
 
 InputRoot.XMLNSC."soapenv:Envelope"."soapenv:Body".(XMLNSC.Element)*.MessageHeader[1];
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Vitor | 
			  
				|  Posted: Fri Jan 29, 2016 5:37 am    Post subject: Re: XML with Soap |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 11 Nov 2005Posts: 26093
 Location: Texas, USA
 
 | 
			  
				| 
   
	| gagan.maverick wrote: |  
	| I tried this 
 InputRoot.XMLNSC."soapenv:Envelope"."soapenv:Body".(XMLNSC.Element)*.MessageHeader[1];
 |  
 Why the double quotes?
 
 If we assume soapenv is correctly declared in your ESQL (and if it's not, I've found your problem) then why not try:
 
 
 
   
	| Code: |  
	| InputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.Nmamaam.MessageHeader[1]; |  
 or
 
 
 
   
	| Code: |  
	| DECLARE whereisheader REFERENCE TO InputRoot.XMLNSC;
 MOVE whereisheader to InputRoot.XMLNSC.soapenv:Envelope.soapenv:Body;
 MOVE whereisheader FIRSTCHILD TYPE XMLNSC.Element;
 MOVE whereisheader REPEAT;
 
 |  
 or put the message through SOAPExtract node and deal with the payload as normal XML
 
 or read the message with a SOAPInput node configured to use JMS instead of an MQInput node
 
 or
 
 ...
 
 or
 
 ..
 _________________
 Honesty is the best policy.
 Insanity is the best defence.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | gagan.maverick | 
			  
				|  Posted: Fri Jan 29, 2016 9:04 am    Post subject: |   |  | 
		
		  | Acolyte
 
 
 Joined: 30 Sep 2014Posts: 50
 
 
 | 
			  
				| Hi 
 Thanks for the reply , but can you tell me , how to declare soapenv i guess that would be the ideal approach.
 
 I guess
 Declare ns namespace something of that sort
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Fri Jan 29, 2016 9:05 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| "soapenv" is a namespace prefix. 
 You can use whatever prefix you want, it doesn't have to be "soapenv".  It just has to point to the correct namespace.
 
 You are otherwise spending a fair amount of time avoiding things that would make it much easier.  That is, all the suggestions made by my esteemable colleague.
 _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | gagan.maverick | 
			  
				|  Posted: Fri Jan 29, 2016 9:44 am    Post subject: |   |  | 
		
		  | Acolyte
 
 
 Joined: 30 Sep 2014Posts: 50
 
 
 | 
			  
				| Hi , I tried this
 DECLARE ns NAMESPACE 'http://sap.com/xi/APPL/Global2';
 DECLARE REFIN_MSG REFERENCE TO InputRoot.XMLNSC.ns:Envelope.ns:Body;
 
 still doesn't seem to work.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Vitor | 
			  
				|  Posted: Fri Jan 29, 2016 9:55 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 11 Nov 2005Posts: 26093
 Location: Texas, USA
 
 | 
			  
				| 
   
	| gagan.maverick wrote: |  
	| I tried this
 DECLARE ns NAMESPACE 'http://sap.com/xi/APPL/Global2';
 DECLARE REFIN_MSG REFERENCE TO InputRoot.XMLNSC.ns:Envelope.ns:Body;
 
 still doesn't seem to work.
 |  
 Really? You sound surprised. I'd be astonished if the Envelope or Body elements were in the http://sap.com/xi/APPL/Global2 namespace.
 
 That's based on my knowledge of the format of a soap message and the XML you yourself posted earlier!
 
 Now that randomly half following one of my suggestions hasn't worked, how about thinking about what I suggested, why I suggested it and coming up with a plan?
 _________________
 Honesty is the best policy.
 Insanity is the best defence.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | gagan.maverick | 
			  
				|  Posted: Fri Jan 29, 2016 10:37 am    Post subject: |   |  | 
		
		  | Acolyte
 
 
 Joined: 30 Sep 2014Posts: 50
 
 
 | 
			  
				| Hi, DECLARE tns NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
 DECLARE REFIN_MSGHEADER REFERENCE TO InputRoot.XMLNSC.tns:Envelope.tns:Body.(XMLNSC.Element)*.MessageHeader[1];
 
 
 This worked, thanks guys
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | smdavies99 | 
			  
				|  Posted: Fri Jan 29, 2016 10:52 pm    Post subject: |   |  | 
		
		  |  Jedi Council
 
 
 Joined: 10 Feb 2003Posts: 6076
 Location: Somewhere over the Rainbow this side of Never-never land.
 
 | 
			  
				| You could work it out for yourself. 
 The FIELDNAME and FIELDNAMESPACE functions could provide the tools you need to dig down into the message tree.
 It requires some work but I've used this before when a message had more than 10 different namespaces. Finding the namespace of an element from the actual message tree unlocked the door.
 _________________
 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 |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Mon Feb 01, 2016 7:13 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| A simple trace of the message tree (trace node, either to a file or to the usertrace (probably a better choice...)) will show you all of the namespace information you need. _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |