I have a soap call that returns xml data in a single array. I need to figure out how to convert this data to a query format, so I can work with the individual columns and rows of data.
Here is a link to see the dump of the data:
Below the dump is an output of the dump using cfoutput.
Here is the code that is used after the soap call (used the tutorial from Ben Nadel for the soap call - http://www.bennadel.com/blog/1809-Making-SOAP-Web-Service-Requests-With-ColdFusion-And-CFHTTP.htm
Now that we have our SOAP body defined, we need to post it as
a SOAP request to the Campaign Monitor website. Notice that
when I POST the SOAP request, I am NOT required to append the
"WSDL" flag to the target URL (this is only required when you
actually want to get the web service definition).
Most SOAP action require some sort of SOAP Action header
to be used.
I typically use this header because CHTTP cannot handle
GZIP encoding. This "no-compression" directive tells the
server not to pass back GZIPed content.
When posting the SOAP body, I use the CFHTTPParam type of
XML. This does two things: it posts the XML as a the BODY
and sets the mime-type to be XML.
NOTE: Be sure to Trim() your XML since XML data cannot be
parsed with leading whitespace.
value="#trim( soapBody )#"
When the HTTP response comes back, our SOAP response will be
in the FileContent atribute. SOAP always returns valid XML,
even if there was an error (assuming the error was NOT in the
communication, but rather in the data).
<cfif find( "200", httpResponse.statusCode )>
<!--- Parse the XML SOAP response. --->
<cfset soapResponse = xmlParse( httpResponse.fileContent ) />
Query for the response nodes using XPath. Because the
SOAP XML document has name spaces, querying the document
becomes a little funky. Rather than accessing the node
name directly, we have to use its local-name().
<cfset responseNodes = xmlSearch(
"//*[ local-name() = 'GetCategoryListResult' ]"
Once we have the response node, we can use our typical
ColdFusion struct-style XML node access.