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 » HTTPRequest parsing response

Post new topic  Reply to topic Goto page 1, 2  Next
 HTTPRequest parsing response « View previous topic :: View next topic » 
Author Message
EnOne
PostPosted: Tue Sep 18, 2012 8:32 am    Post subject: HTTPRequest parsing response Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

the out from my HTTPRequest node trace looks like this
Code:
(0x01000000:Folder):XMLNSC             = ( ['xmlnsc' : 0x1160e4df0]
    (0x01000000:Folder)http://schemas.xmlsoap.org/soap/envelope/:Envelope = (
      (0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:soap             = 'http://schemas.xmlsoap.org/soap/envelope/' (CHARACTER)
      (0x01000000:Folder       )http://schemas.xmlsoap.org/soap/envelope/:Body = (
        (0x01000000:Folder)http://webservices.server.com/:addResponse = (
          (0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:ns1 = 'http://webservices.server.com/' (CHARACTER)
          (0x01000000:Folder       ):Document                         = (
            (0x01000000:Folder     ):attributes =
            (0x03000000:PCDataField):id         = '79' (CHARACTER)
            (0x03000000:PCDataField):imagetype  = 'NATIVE' (CHARACTER)
            (0x03000000:PCDataField):repository = 'ContentManager' (CHARACTER)
          )
        )
      )
    )

I also connected the 'out' to a queue to view the response data.
Code:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns1:addResponse xmlns:ns1="http://webservices.server.com/">
         <Document xmlns:ns2="http://webservices.server.com/">
            <attributes/>
            <id>79</id>
            <imagetype>NATIVE</imagetype>
            <repository>ContentManager</repository>
         </Document>
      </ns1:addResponse>
   </soap:Body>
</soap:Envelope>


I am unable to retrieve the value of <id>79</id> from this response I have tried everything I can think of and now I am guessing what ESQL to write.

Code:

InputRoot.XMLNSC."http://schemas.xmlsoap.org/soap/envelope/:Envelope"."http://schemas.xmlsoap.org/soap/envelope/:Body"."http://webservices.server.com/:addResponse"."Document"."id";
InputRoot.XMLNSC."soap:Envelope"."soap:Body"."ns1:addResponse"."Document"."id"
InputRoot.XMLNSC."soap:Envelope"."soap:Body"."addResponse"."Document"."id";
InputRoot.XMLNSC."ns1:addResponse"."Document"."id"
InputRoot.XMLNSC."addResponse"."Document"."id"


I also tried using CAST or FIELDVALUE also InputRoot.XML and InputRoot.XMLNS but everything comes back NULL;
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Sep 18, 2012 8:34 am    Post subject: Reply with quote

Jedi Knight

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

You may find better success reading the value by using DECLARE NAMESPACE first.

Had you attended the WMB Dev I & II classes? They show you how to do just that.
_________________
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
EnOne
PostPosted: Tue Sep 18, 2012 8:58 am    Post subject: Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

simple enough to declare the namespace you can see them in the trace

Code:

DECLARE ns1 NAMESPACE 'http://webservices.server.com/'
DECLARE ns2 NAMESPACE 'http://webservices.server.com/'
DECLARE soap NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/'


then I retried the applicable lines of code with no response

Code:

InputRoot.XMLNSC."soap:Envelope"."soap:Body"."ns1:addResponse"."Document"."id"
InputRoot.XMLNSC."soap:Envelope"."soap:Body"."ns1:addResponse"."ns2:Document"."ns2:id";
InputRoot.XMLNSC."ns1:addResponse"."Document"."id"
InputRoot.XMLNSC."ns1:addResponse"."ns2:Document"."ns2:id"
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Sep 18, 2012 9:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't need "" on most of those field references.

I'm not saying it's causing the problem, mind you.

The one you have that should be correct is
Code:
InputRoot.XMLNSC."soap:Envelope"."soap:Body"."ns1:addResponse"."Document"."id"

since neither Document nor id are qualified with a namespace, they merely happen to carry namespace declarations with them.

It is good to be in practice with user tracing, so you might want to review the results of that in your code and see if anything sticks out, too.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Sep 18, 2012 9:20 am    Post subject: Reply with quote

Jedi Knight

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

I don't do much with HTTP nodes, most of my work is with SOAP nodes, which are the next layer up.

For a SOAPInput node or the happy path reply message from a SOAPRequest node, I would write something like this...

Code:
DECLARE processXYZ NAMESPACE 'https://www.XYZrdc.com/XYZService';   


SET X = InputRoot.SOAP.Body.processXYZ:somesoapResponseMessage.thevalueofX;

_________________
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
mgk
PostPosted: Tue Sep 18, 2012 9:28 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

When you have declared the namespaces you should remove the quotes and use:

Code:
InputRoot.XMLNSC.soap:Envelope.soap:Body.ns1:addResponse.Document.id


With the quotes you are forcing the reference to look for an element called "soap:Envelope" (for example) rather than an element called Envelope in the soap namespace.

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
lancelotlinc
PostPosted: Tue Sep 18, 2012 9:31 am    Post subject: Reply with quote

Jedi Knight

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

I said to myself: "Self, I wonder if the OP should be using SOAP nodes rather than HTTP nodes since he is processing SOAP traffic anyway."
_________________
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
EnOne
PostPosted: Tue Sep 18, 2012 10:13 am    Post subject: Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

Tried this with nothing returned for any of them

Code:

DECLARE ns1 NAMESPACE 'http://webservices.server.com';
DECLARE ns2 NAMESPACE 'http://webservices.server.com';
DECLARE soap NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';

InputRoot.XMLNSC.soap:Envelope.soap:Body.ns1:addResponse.Document.id
InputRoot.XMLNSC.soap:Envelope.soap:Body.ns1:addResponse.ns2:Document.id
InputRoot.XMLNSC.soap:Envelope.soap:Body.ns1:addResponse.ns2:Document.ns2:id


I switched the HTTPRequest node to return XML instead of XMLNSC so the trace was this
Code:
(0x01000010:ParserRoot):XML                = ( ['xml' : 0x1181b25b0]
    (0x01000000:Element):soap:Envelope = (
      (0x03000000:Attribute):xmlns:soap = 'http://schemas.xmlsoap.org/soap/envelope/' (CHARACTER)
      (0x01000000:Element  ):soap:Body  = (
        (0x01000000:Element):ns1:addResponse = (
          (0x03000000:Attribute):xmlns:ns1 = 'http://webservices.server.com/' (CHARACTER)
          (0x01000000:Element  ):Document  = (
            (0x01000000:Element):attributes =
            (0x01000000:Element):id         = (
              (0x02000000:pcdata): = '79' (CHARACTER)
            )
            (0x01000000:Element):imagetype  = (
              (0x02000000:pcdata): = 'NATIVE' (CHARACTER)
            )
            (0x01000000:Element):repository = (
              (0x02000000:pcdata): = 'ContentManager' (CHARACTER)
            )
          )
        )
      )
    )


and was able to use this

Code:
InputRoot.XML."soap:Envelope"."soap:Body"."ns1:addResponse".Document.id


I know the XML parser is supposed to be deprecated but I was unable to map the response from XMLNS or XMLNSC
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Sep 18, 2012 10:41 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

lancelotlinc wrote:
I said to myself: "Self, I wonder if the OP should be using SOAP nodes rather than HTTP nodes since he is processing SOAP traffic anyway."


sometimes you need to use a "SOAP" message with the HTTP nodes because there is no usable WSDL abailable from the supplier. I am faced with that on my current project. The supplier calls is 'a WebService Interface' but it is anything but in reality. His supplied XSD also fails w3c validation for a start. Using a compliant one gets your message rejected. etc etc etc.

So we end up using what can be loosely called a SOAP message because it has a SOAP namespace ... and you send it using the HTTP nodes. <redacted> amateur developers.

Now don't get me going on the preculariaties of the ModBus protocol or Processing SNMP traps with Broker.
_________________
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
View user's profile Send private message
mgk
PostPosted: Tue Sep 18, 2012 10:54 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
sometimes you need to use a "SOAP" message with the HTTP nodes because there is no usable WSDL abailable from the supplier


If a lack of WSDL is the only problem then you can use Gateway mode to configure the SOAP nodes without a WSDL. However, in your case, it sounds like HTTP may be a better fit


EnOne: Did you try the code I posted above, because that should work...


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
lancelotlinc
PostPosted: Tue Sep 18, 2012 10:55 am    Post subject: Reply with quote

Jedi Knight

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

smdavies99 wrote:
lancelotlinc wrote:
I said to myself: "Self, I wonder if the OP should be using SOAP nodes rather than HTTP nodes since he is processing SOAP traffic anyway."


sometimes you need to use a "SOAP" message with the HTTP nodes because there is no usable WSDL abailable from the supplier.


So, if you use Google Chrome to browse the WSDL, none is returned?

Quote:
http://www.xignite.com/xRealTime.asmx?WSDL


I thought the Wild Wild West days were over, and everyone supports ?wsdl with their service.
_________________
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
mgk
PostPosted: Tue Sep 18, 2012 11:02 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
So, if you use Google Chrome to browse the WSDL, none is returned?


Correct. Gateway mode was introduced to allow one Broker flow to route traffic for multiple services rather than needing one flow per service. One flow per service is fine for many services, but does not scale to hundreds or thousands of them...

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
Vitor
PostPosted: Tue Sep 18, 2012 11:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lancelotlinc wrote:
smdavies99 wrote:
lancelotlinc wrote:
I said to myself: "Self, I wonder if the OP should be using SOAP nodes rather than HTTP nodes since he is processing SOAP traffic anyway."


sometimes you need to use a "SOAP" message with the HTTP nodes because there is no usable WSDL abailable from the supplier.


So, if you use Google Chrome to browse the WSDL, none is returned?

Quote:
http://www.xignite.com/xRealTime.asmx?WSDL


I thought the Wild Wild West days were over, and everyone supports ?wsdl with their service.


Guess again; I have exactly the same position.

I also (and rather more alarmingly) have 1 XML document which arrives as a file from an external vendor which doesn't match the XSD they supply for the document, and which the XML refers to. When queried on this, their response was (and I quote their technical support directly):

Quote:
Well we've never made keeping it up to date a priority.I mean, the XSD is only a guide anyway; the document doesn't have to match it exactly


For once, words escaped even me.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Sep 18, 2012 11:51 am    Post subject: Reply with quote

Jedi Knight

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

I can see human consumable XML payloads varying and the XSD being a guide. For machine consumable payloads, I would find a way to bring pressure to bear to force the compliance issue.

An XSD/WSDL is a contract to exchange data between a producer and consumer. If the contract is not honored, then the transaction should fail.
_________________
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
fjb_saper
PostPosted: Tue Sep 18, 2012 12:04 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

So what you should have been using is:
Code:
InputRoot.XMLNSC.soap:Envelope.soap:Body.ns1:addResponse.Document.(XMLNSC.Attribute)id


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » HTTPRequest parsing response
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.