• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to parse GetSOAPRequest result

Community Beginner ,
Oct 11, 2006 Oct 11, 2006

Copy link to clipboard

Copied

Hi,

Can someone help me, how can I parse the following GetSOAPRequest result? The following xml is the sample that I am trying to parse. Thank you.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getCountriesListResponse xmlns=" http://www.voxbone.com/VoxService">
<countries>
<ns1:Country xmlns:ns1=" http://containers.services.webservices.voxbone">
<availableDidsCount xmlns=" http://containers.services.webservices.voxbone">79</availableDidsCount>
<countryCodeA2 xmlns=" http://containers.services.webservices.voxbone">AR</countryCodeA2>
<countryName xmlns=" http://containers.services.webservices.voxbone">ARGENTINA</countryName>
<countryPhoneCode xmlns=" http://containers.services.webservices.voxbone">54</countryPhoneCode>
</ns1:Country>
<ns1:Country xmlns:ns1=" http://containers.services.webservices.voxbone">
<availableDidsCount xmlns=" http://containers.services.webservices.voxbone">73</availableDidsCount>
<countryCodeA2 xmlns=" http://containers.services.webservices.voxbone">BR</countryCodeA2>
<countryName xmlns=" http://containers.services.webservices.voxbone">BRAZIL</countryName>
<countryPhoneCode xmlns=" http://containers.services.webservices.voxbone">55</countryPhoneCode>
</ns1:Country>
</countries>
</getCountriesListResponse>
</soap:Body>
TOPICS
Advanced techniques

Views

464

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Oct 13, 2006 Oct 13, 2006
Hi Mike,

I had it working with this code snippet.

<cfset xmlContainer = Xmlparse(outxml)>
<cfset aCountries = xmlContainer["soap:Envelope"]["soap:Body"].getCountriesListResponse.countries.XmlChildren>

Thank you very much!

Votes

Translate

Translate
Advisor ,
Oct 11, 2006 Oct 11, 2006

Copy link to clipboard

Copied

That's not a valid soap request.

It's missing </soap:Envelope> at the end.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2006 Oct 12, 2006

Copy link to clipboard

Copied

Here's my code to pull the GetSOAPRequest result. I want to display it by: ie. Country Name, Country code & etc. But it is difficult to do an xmlparse due to ie "soap:Envelope" notation. Appreciate it if somebody could help me show how to parse a GetSOAPRequest result.

Thanks a lot!

<cfscript>
ws = CreateObject("webservice", " http://www.voxbone.com/ws/services/VoxService?wsdl");
ret = ws.GetCountriesList(args);

</cfscript>

<cfset outxml = GetSOAPResponse(ws)>
<h2>SOAP Response</h2>
<cfoutput>#outxml#</cfoutput>
<cfdump var="#outxml#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 12, 2006 Oct 12, 2006

Copy link to clipboard

Copied

XmlSearch() is about useless with ¿non standard? name spaces.

Anyway, does the attached code get you started?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2006 Oct 12, 2006

Copy link to clipboard

Copied

Mike,

I tried parsing it using xmlparse and xmlsearch but it wasn't friendly anymore. I tried your code and it give me an error:

seems that it can't read this line. "outxml["soap:Envelope"]["soap:Body"].getCountriesListResponse.countries.XmlChildren;"

I'm new to this and I googled it but can't see solutions for this soap parsing.

The sequence of the notation is exactly the same as the soap response. Any other trick?

Thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 12, 2006 Oct 12, 2006

Copy link to clipboard

Copied

That parse code works on the XML you supplied above.

Please run the following code and attach the results here:

<CFSCRIPT>
ws = CreateObject ("webservice", " http://www.voxbone.com/ws/services/VoxService?wsdl");
ret = ws.GetCountriesList (args);

outxml = GetSOAPResponse (ws);
// aCountries = outxml["soap:Envelope"]["soap:Body"].getCountriesListResponse.countries.XmlChildren;
</CFSCRIPT>
<CFDUMP var="#ret#">
<CFDUMP var="#outxml#">


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2006 Oct 13, 2006

Copy link to clipboard

Copied

Hi,

The code was too long to attach here. Here's a link below to show the SOAP dump results at

http://melo3.melotec.com:60/voxbone.cfm

<CFSCRIPT>
ws = CreateObject ("webservice", " http://www.voxbone.com/ws/services/VoxService?wsdl");
ret = ws.GetCountriesList (args);

outxml = GetSOAPResponse (ws);
// aCountries = outxml["soap:Envelope"]["soap:Body"].getCountriesListResponse.countries.XmlChildren;
</CFSCRIPT>
<CFDUMP var="#ret#">
<CFDUMP var="#outxml#">


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2006 Oct 13, 2006

Copy link to clipboard

Copied

LATEST
Hi Mike,

I had it working with this code snippet.

<cfset xmlContainer = Xmlparse(outxml)>
<cfset aCountries = xmlContainer["soap:Envelope"]["soap:Body"].getCountriesListResponse.countries.XmlChildren>

Thank you very much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation