Problems extracting data from a SOAP response's XML

44 views
Skip to first unread message

KHinch

unread,
Jul 1, 2009, 3:25:58 PM7/1/09
to Adobe LiveCycle Developers
I am using the Foundation/Web Service process to receive data to place
in a Form. My problem is extracting the data from the SOAP
responses. The response are mapped to a variable "soap_response" of
type XML. An example response:
----------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<synchronousInvokeResponse xmlns="http://adobe.com/workflow/
services/set_ordermerge_es">
<dob>05/25/55</dob>
<emergencycontactphone>Not on file</emergencycontactphone>
<emergencycontactname/>
<phone>555-223-4955</phone>
<sex>Female</sex>
<zip>99555</zip>
<state>TX</state>
<city>AnyTown</city>
<address>3740 Main St</address>
<billing_results>OK</billing_results>
<processID xsi:type="xsd:long">1223187</processID>
</synchronousInvokeResponse>
</soapenv:Body>
</soapenv:Envelope>
----------
A sample XPATH statement:
/process_data/soap_response/soapenv:Envelope/soapenv:Body/
synchronousInvokeResponse/dob
(or any other value) will return nothing.

If I pass:
serialize(/process_data/soap_response/soapenv:Envelope/soapenv:Body/
*,false)
to a variable I receive:
----------
<synchronousInvokeResponse xmlns="http://adobe.com/workflow/
services/set_ordermerge_es">
<dob>05/25/55</dob>
<emergencycontactphone>Not on file</emergencycontactphone>
<emergencycontactname/>
<phone>555-223-4955</phone>
<sex>Female</sex>
<zip>99555</zip>
<state>TX</state>
<city>AnyTown</city>
<address>3740 Main St</address>
<billing_results>OK</billing_results>
<processID xsi:type="xsd:long">1223187</processID>
</synchronousInvokeResponse>
----------
but I still can't manipulate or access any of the data below
"synchronousInvokeResponse".


There are 3 other implementations of similar Web Services in my
workflows. This is the first time I've had any issue obtaining data
from a SOAP response's XML I might be missing something here, but I
just can't see it...so I'm really banking on "given enough eyeballs,
all bugs are shallow" on this one.

Cheers,
Kasey

hemen.kapadia

unread,
Jul 2, 2009, 1:40:07 AM7/2/09
to Adobe LiveCycle Developers
Hi,

Assume you need to extract the value of the node 'phone' can you try
something like

/process_data/soap_response//phone

assuming that soap_response is of the type xml and set as the output
of the Webservice DSC.

-Hemen

Parth Pandya

unread,
Jul 2, 2009, 2:42:29 AM7/2/09
to Adobe LiveCycle Developers

KHinch

unread,
Jul 2, 2009, 11:47:09 AM7/2/09
to Adobe LiveCycle Developers
Thank you very much everyone who replied! I had tried the double bar
(//) notation early without success. Revisiting the issue this
morning, the <synchronousInvokeResponse xmlns="http://adobe.com/
workflow/
services/set_ordermerge_es> got me thinking this may be a namespace
issue. I mapped a namespace "set" to "http://adobe.com/workflow/
services/set_ordermerge_es" and now the xpath statements correctly
grab my data with the XPATH statements:

/process_data/soap_response/soapenv:Envelope/soapenv:Body/
set:synchronousInvokeResponse/set:phone

and

/process_data/soap_response//set:phone

Thanks again, Happy 4th of July!

Kasey

KHinch

unread,
Jul 2, 2009, 11:58:26 AM7/2/09
to Adobe LiveCycle Developers
Thank you to all who replied. The double-bar (//) wasn't working for
me yesterday, but this morning the eslifeline blog post got me
thinking this may be a namespace issue.

I mapped a ns "set" to "http://adobe.com/workflow/services/
set_ordermerge_es"

And now the XPATHs

/process_data/soap_response/soapenv:Envelope/soapenv:Body/
set:synchronousInvokeResponse/set:dob

/process_data/soap_response//set:dob

Work as intended!

Have a great 4th of July!

-Kasey

On Jul 1, 11:42 pm, Parth Pandya <pandyapa...@gmail.com> wrote:
> Hi Hemen,
> Have a look at thishttp://eslifeline.wordpress.com/2009/02/06/using-namespace-in-workbench/
Reply all
Reply to author
Forward
0 new messages