ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to navigate in SOAP Body with WMB

Post new topic  Reply to topic
 How to navigate in SOAP Body with WMB « View previous topic :: View next topic » 
Author Message
wurglsam
PostPosted: Mon Jul 02, 2012 5:55 am    Post subject: How to navigate in SOAP Body with WMB Reply with quote

Newbie

Joined: 02 Jul 2012
Posts: 7

Hi

I'm trying to navigate in a SOAP message Body but I'm fighting to find the right code.

My message is the following:

Quote:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
<soapenv:Header/>
<soapenv:Body>
<urn:ZoumGetShipTenderInb>
<IvShipmentAttr>
<TargetSystem>XXX</TargetSystem>
</IvShipmentAttr>
</urn:ZoumGetShipTenderInb>
</soapenv:Body>
</soapenv:Envelope>


I'm trying to get the value of "Target" with the following code in a Compute mode:


Quote:
SET InputLocalEnvironment.TARGET = InputRoot.SOAP.Body.urn:ZoumGetShipTenderInb.IvShipmentAttr.TargetSystem ;


But I receive the following error message:

Quote:
Failed to navigate to path element number '4' because it does not exist.


Could you please share your thoughts?

Thanks in advance.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jul 02, 2012 5:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

"Body" has a namespace.

Your code doesn't.
Back to top
View user's profile Send private message
wurglsam
PostPosted: Mon Jul 02, 2012 6:09 am    Post subject: Reply with quote

Newbie

Joined: 02 Jul 2012
Posts: 7

But "Body" is the standard SOAP Body in my understanding. So if I'm not wrong the standard tree to look into it is Root.SOAP.Body.

I tried with soapenv:Body but I have the same error message.

FYI, the following is working fine. If I look in the Header, similar as the following:

Quote:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
<soapenv:Header>
<Target>XXX</Target>
</soapenv:Header>


This is working fine with the following code:

Quote:
SET InputLocalEnvironment.TARGET = InputRoot.SOAP.Header.Target ;


But I don't understand how to go in the Body...
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Jul 02, 2012 6:38 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Did you DECLARE NAMESPACE for urn? The parser is having an issue with the element after Body (ie. element 4). When you CONTROL-SPACE in the ESQL editor, do you successfully resolve the next element?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon Jul 02, 2012 6:48 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

In ESQL, if you want to refer to an element that has a namespace then you need to
Code:
DECLARE NAMESPACE shortPrefix "someBigLongURL";

Then you can reference the element as
Code:
InputRoot.shortPrefix:elementName;
The actual string for 'shortPrefix' can be different from the ns prefix declared in the XML document. But I would recommend that you keep them the same because it is less confusing that way.
See this thread - especially the last couple of sentences of my post: http://www.mqseries.net/phpBB2/viewtopic.php?p=332390&sid=68cfc55cae073b18f05c792981da21b2
Back to top
View user's profile Send private message
mgk
PostPosted: Mon Jul 02, 2012 7:12 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
"Body" has a namespace.

Your code doesn't.


This is not true for the SOAP domain - it abstracts away the namespace on the Envelope and so SOAP and Body should not be NS qualified.

For the message you give, your ESQL line looks correct. In fact I do not believe that this line:

Code:
SET InputLocalEnvironment.TARGET = InputRoot.SOAP.Body.urn:ZoumGetShipTenderInb.IvShipmentAttr.TargetSystem ;


Can give this error:

Quote:
Failed to navigate to path element number '4' because it does not exist.


This is because the error above can only be produced when accessing repeating elements (like with the square brackets
Code:
 [4]
).

Check again that the line you give really is the source of the error...

Kind Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
wurglsam
PostPosted: Mon Jul 02, 2012 7:38 am    Post subject: Reply with quote

Newbie

Joined: 02 Jul 2012
Posts: 7

Thanks for your reply.
It's finally working with the following:

SET InputLocalEnvironment.TARGET = InputRoot.SOAP.Body.*:ZoumGetShipTenderInb.IvShipmentAttr.TargetSystem ;

But I can't have this namespace working properly. I think I have some issue in the declaration but I will investigate further. In the meantime I have a workaround, even if it's not really the best one.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Jul 02, 2012 8:15 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I can't have this namespace working properly. I think I have some issue in the declaration
My code example was wrong. This should work:
Code:
DECLARE urn NAMESPACE "urn:sap-com:document:sap:soap:functions:mc-style";
SET InputLocalEnvironment.TARGET = InputRoot.SOAP.Body.urn:ZoumGetShipTenderInb.IvShipmentAttr.TargetSystem ;

and (just to reinforce the point) so should this:
Code:
DECLARE wurglsam NAMESPACE "urn:sap-com:document:sap:soap:functions:mc-style";
SET InputLocalEnvironment.TARGET = InputRoot.SOAP.Body.wurglsam:ZoumGetShipTenderInb.IvShipmentAttr.TargetSystem ;
Back to top
View user's profile Send private message
wurglsam
PostPosted: Mon Jul 02, 2012 10:58 pm    Post subject: Reply with quote

Newbie

Joined: 02 Jul 2012
Posts: 7

I actually tried it but when I create the BAR file and try to deploy it, I receive the following error message during deployment:

Quote:
BIP2432E: (.SOAAAA02_Compute.CopyEntireMessage, 2.25) : The correlation name 'urn:sap-com:document:sap:soap:functions:mc-style' is not valid. Those in scope are: ErrorLoggingOn, RequestLoggingOn, ResponseLoggingOn, Environment, InputLocalEnvironment, OutputLocal... (data of len 253 truncated).

The first element of a field reference must be a valid correlation name, from those in scope. This message may sometimes be due to an incorrectly formed or spelled expression which is not intended to be a field reference being parsed as if it were a field reference because the parser does not recognize it.

Correct the syntax of your ESQL expression in node '.SOAAAA02_Compute.CopyEntireMessage', around line and column '2.25', then redeploy the message flow.


So I don't really understand as this namespace is declared in the WSDL I imported...
Back to top
View user's profile Send private message
mgk
PostPosted: Mon Jul 02, 2012 11:32 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

I believe the problem is that this:

Code:
DECLARE urn NAMESPACE "urn:sap-com:document:sap:soap:functions:mc-style";

Should be:

Code:
DECLARE urn NAMESPACE 'urn:sap-com:document:sap:soap:functions:mc-style';


As string literals use single quotes...
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
wurglsam
PostPosted: Mon Jul 02, 2012 11:34 pm    Post subject: Reply with quote

Newbie

Joined: 02 Jul 2012
Posts: 7

You're absolutely right: it's working now

Thanks a lot guys for your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to navigate in SOAP Body with WMB
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.