|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Parsing SOAP message |
« View previous topic :: View next topic » |
Author |
Message
|
j2soccer |
Posted: Tue May 22, 2007 5:57 pm Post subject: Parsing SOAP message |
|
|
Newbie
Joined: 21 May 2007 Posts: 5
|
Hi,
For SOAP message I know it is better to use XMLNS/XMLNSC parser. I just want to try to use XML parser and I know this doesn't sounds the best a good effort. But for my curiosity, how to retrieve part of the InputRoot so i can get value of 'firstName' here:
here is the ecxcerpt of the trace msg:
Code: |
(0x01000010):XML = (
(0x05000018):XML = (
(0x06000011): = '1.0'
(0x06000012): = 'UTF-8'
)
(0x01000000):soapenv:Envelope = (
(0x03000000):xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
(0x03000000):xmlns:xsd = 'http://www.w3.org/2001/XMLSchema'
(0x03000000):xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x01000000):soapenv:Body = (
(0x01000000):shipPartRequest = (
(0x03000000):xmlns = 'http://www.acmeOrders.com/ShippingService'
(0x01000000):partNo = (
(0x03000000):xmlns = ''
(0x02000000): = '123'
)
(0x01000000):partQuantity = (
(0x03000000):xmlns = ''
(0x02000000): = '0'
)
(0x01000000):personName = (
(0x03000000):xmlns = ''
(0x01000000):firstName = (
(0x02000000): = 'mark'
)
(0x01000000):lastName = (
(0x02000000): = 'white'
)
)
(0x01000000):address = (
(0x03000000):xmlns = ''
(0x01000000):street = (
(0x02000000): = '1234'
)
(0x01000000):city = (
(0x02000000): = 'new york'
)
(0x01000000):zipCode = (
(0x02000000): = '456000'
)
)
)
)
)
) |
I can get the value using this way; -- OK
Code: |
FIELDVALUE(InputRoot.XML.(XML.Element)[0].(XML.Element)[0].(XML.Element)[0].(XML.Element)[1]); |
But it is kind of too complex. I would like to see this kind of code but this code doesn't work --Not OK
FIELDVALUE
Code: |
(InputRoot.XML.Envelope.Body.shipPartRequest.personName.firstName*[0])
|
I appreciate you reply. |
|
Back to top |
|
 |
j2soccer |
Posted: Tue May 22, 2007 5:58 pm Post subject: |
|
|
Newbie
Joined: 21 May 2007 Posts: 5
|
Sorry the last statement should be like this
Code: |
FIELDVALUE(InputRoot.XML.Envelope.Body.shipPartRequest.personName.firstName*[0]) |
|
|
Back to top |
|
 |
mgk |
Posted: Tue May 22, 2007 7:34 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi.
For the life of me I can't see why you want to do this, but seeing as you do, look more closely at the trace node output:
(0x01000000):soapenv:Envelope
A (0x01000000) type element is a NAME element, so the name of this element is not Envelope it is 'soapenv:Envelope' so this is the name you should use (in quotes) in your field reference when accessing this element. This will also apply to the body and to any other element that is namespace qualified.
Therefore in this case it will look something like (untested):
Code: |
FIELDVALUE(InputRoot.XML."soapenv:Envelope"."soapenv:Body".shipPartRequest.personName.firstName); |
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 |
|
 |
j2soccer |
Posted: Tue May 22, 2007 8:35 pm Post subject: |
|
|
Newbie
Joined: 21 May 2007 Posts: 5
|
That code work. Thanks MGK. Actually I was just kind of curious into how to parse message using different parser. I get it working for all XML parser but this one (InputRoot.XML). I did try your solution but without 'quote's.
Again appreciate your reply. I give you 10 points. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|