Okay, so I've been messing around with my SOAP response and I've gotten a
little further, but not much. The response I get back looks like this:
soap:Envelope
XmlText
XmlAttributes
struct
soap:Header
XmlText
UserCredentials
XmlText
XmlAttributes
struct
userid
myUserID
password
myPassword
producttype
W
returncode
0
soap:Body
YearsResponse
YearsResult
diffgr:diffgram
modelyears
years
year
2010
year
2009
year
2008
year
2007
year
2006
year
2005
I would assume (I guess wrongly so) that my xPathString should be:
/soap:Envelope/soap:Body/YearsResponse/YearsResult/
diffgr:diffgram/modelyears/years/year
but this doesn't work. an xPathString of just /soap:Envelope/soap:Body/ does
work, but I should be able to dig deeper shouldn't I?
Thanks,
Chris
On Fri, Jan 23, 2009 at 12:31 PM, Chris Jordan <[email protected]>wrote:
> I've got a SOAP response in xml format, and I need to know how to traverse
> it. I found that I should be able to use XmlSearch(xmlDoc, xPathString) to
> return an array of nodes, but this just isn't working for me.
>
> <cfsavecontent variable="soapRequest">
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:used="http://localhost/webservices/UsedCarWS">
> <soapenv:Header>
> <used:UserCredentials>
> <!--Optional:-->
> <used:userid>xxxxx</used:userid>
> <!--Optional:-->
> <used:password>xxxxx</used:password>
> <!--Optional:-->
> <used:producttype>W</used:producttype>
> </used:UserCredentials>
> </soapenv:Header>
> <soapenv:Body>
> <used:Years>
> <!--Optional:-->
> <used:sCountryCode>U</used:sCountryCode>
> </used:Years>
> </soapenv:Body>
> </soapenv:Envelope>
> </cfsavecontent>
>
> <cfhttp url="https://www.blackbookws.com/UsedCarWS.asmx?WSDL"
> method="POST" resolveurl="NO" useragent="Axis/1.1">
> <cfhttpparam type="xml" name="body" value="#soapRequest#">
> </cfhttp>
>
> <cfset soapresponse = XMLParse(cfhttp.FileContent) />
> <cfset YearNodes =
> xmlSearch(soapresponse,"/Envelope/Body/YearsResponse/YearsResult/diffgram/modelyears/years/year/XmlText")>
>
> <cfdump var="#YearNodes#">
> <cfdump var="#soapresponse#">
>
> The dump of soapresponse shows me the structure of the xmlDocument, but
> the dump of YearNodes just isn't working. It's always empty. What could I
> be doing wrong?
>
> Thanks,
> Chris
>
> --
> http://cjordan.us
>
--
http://cjordan.us
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318438
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4