Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3495884
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:10:52+00:00 2026-05-18T12:10:52+00:00

I get the following XML back from an ASP-NET webservice (that alone took me

  • 0

I get the following XML back from an ASP-NET webservice (that alone took me 3 days). But because I’m such an XML nube, I don’t know how to format it into a basic display table. I need it to be in coldfusion because that’s all I understand and my site is a CF site. It uses diffgram which I also know nothing about. But, I’m ready to learn!

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <BillingResponse xmlns="http://portal/customer.asmx">       
            <BillingResult>
                <xs:schema id="NewDataSet" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                    <xs:element msdata:IsDataSet="true" msdata:UseCurrentLocale="true" name="NewDataSet">
                        <xs:complexType>
                            <xs:choice maxOccurs="unbounded" minOccurs="0">
                                <xs:element name="Table">
                                    <xs:complexType>
                                        <xs:sequence>
                                            <xs:element minOccurs="0" name="CustomerCode" type="xs:int"/>
                                            <xs:element minOccurs="0" name="ServiceCode" type="xs:int"/>
                                            <xs:element minOccurs="0" name="SubscriberCode" type="xs:string"/>
                                            <xs:element minOccurs="0" name="Status" type="xs:string"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:element>
                            </xs:choice>
                        </xs:complexType>
                    </xs:element>
                </xs:schema>

                <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

                    <NewDataSet xmlns="">
                        <Table diffgr:id="Table1" msdata:rowOrder="0">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>0</ServiceCode>
                            <SubscriberCode/>
                            <Status/>
                        </Table>
                        <Table diffgr:id="Table2" msdata:rowOrder="1">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>2</ServiceCode>
                            <SubscriberCode>95205292</SubscriberCode>
                            <Status>OPEN</Status>
                        </Table>
                        <Table diffgr:id="Table3" msdata:rowOrder="2">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>8</ServiceCode>
                            <SubscriberCode>dageorgetti</SubscriberCode>
                            <Status>1</Status>
                        </Table>
                        <Table diffgr:id="Table4" msdata:rowOrder="3">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>16</ServiceCode>
                            <SubscriberCode>NTL00711</SubscriberCode>
                            <Status>CLOSED</Status>
                        </Table>
                        <Table diffgr:id="Table5" msdata:rowOrder="4">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>16</ServiceCode>
                            <SubscriberCode>95205292</SubscriberCode>
                            <Status>CLOSED</Status>
                        </Table>
                        <Table diffgr:id="Table6" msdata:rowOrder="5">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>16</ServiceCode>
                            <SubscriberCode>95205292</SubscriberCode>
                            <Status>OPEN</Status>
                        </Table>
                        <Table diffgr:id="Table7" msdata:rowOrder="6">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>4096</ServiceCode>
                            <SubscriberCode>64280452637</SubscriberCode>
                            <Status>OPEN</Status>
                        </Table>
                        <Table diffgr:id="Table8" msdata:rowOrder="7">
                            <CustomerCode>1114309</CustomerCode>
                            <ServiceCode>4096</ServiceCode>
                            <SubscriberCode>64280426643</SubscriberCode>
                            <Status>OPEN</Status>
                        </Table>
                    </NewDataSet>
                </diffgr:diffgram>
            </BillingResult>
        </BillingResponse>
    </soap:Body>
</soap:Envelope>

Any code snippet or help through this horror show would be greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:10:53+00:00Added an answer on May 18, 2026 at 12:10 pm

    Normally when consuming a SOAP webservice from ColdFusion you would use <cfinvoke> and things would come back in a close-to-native format.

    However, and especially when consuming ASP.NET ASMX webservices, I’ve found that the returned XML and ColdFusion’s parser don’t always play nice; so I tend to do the processing manually.

    This code is from a method I wrote to make API calls. First, make the HTTP request manually:

    <cftry>
        <cfhttp
            url="#wsLocation#"
            result="local.wsResult"
            method="post"
            timeout="#variables.timeout#"
            throwonerror="true"
        >
            <cfhttpparam type="formfield" name="inputName" value="inputValue" />
            <cfhttpparam type="formfield" name="inputName" value="inputValue" />
            <cfhttpparam type="formfield" name="inputName" value="inputValue" />
        </cfhttp>
    

    Then check for common error conditions: (you may run into some-of/all-of/none-of/more-than these)

        <cfif trim(local.wsResult.fileContent) eq "Connection Timeout">
            <cfthrow message="Request timeout while connecting to .Net API" detail="#local.wsResult.statusCode#" />
        </cfif>
        <cfif not isXML(local.wsResult.FileContent)>
            <cfthrow message="ASP.NET WS did not return valid XML." detail="#local.wsResult.FileContent#" />
        </cfif>
    

    Then, parse the returned xml, and return just the part you’re interested in:

        <cfset local.wsResponse = xmlParse(local.wsResult.Filecontent) />
        <cfset local.rspContainer = local.wsResponse['soap:envelope']['soap:body'].BillingResponse.BillingResult />
    
        <cfcatch>
            <cfset local.arguments = arguments />
            <cfset errorEmail(cfcatch, local) />
            <cfreturn "" />
        </cfcatch>
    </cftry>
    <cfreturn local.rspContainer />
    

    This would return the <BillingResponse> node and everything inside it.

    Then you need to parse that for the data you need. You could do it with XPath expressions and the XMLSearch function, or if the data is simple, just grab it manually.

    The DiffGram xml you reference is probably because you’re returning a DataTable object in your .Net code. Here’s how I handle that in ColdFusion:

    dataContainer = apiRequest(whatever); //calls the method above
    

    First make sure there are child elements to get:

    local.emptySet = QueryNew("GivenName,Surname,FileAs,CompanyName");
    if (not structKeyExists(local.dataContainer, "DocumentElement")){ return local.emptySet; }
    //emptySet is whatever object you're converting the xml into, only with no data, so 
    //maybe an empty query or structure or something.
    

    Then get the array of child elements:

    local.items = local.dataContainer.DocumentElement.XmlChildren;
    

    In my case, I’m creating a query, so I add enough rows to the query to hold all of the data:

    //create enough rows in the query to store the contact data
    QueryAddRow(local.emptySet, arrayLen(local.items));
    

    Then loop over each node in the array of child elements, copying the value to the query. The variable local.fieldList is a list of xml nodes inside each row in your DataTable, and it will use the list to get each field. The outer loop iterates over the rows in the DataTable, and the inner loop iterates over the columns in the row. I’ve lopped off a lot from my list to keep the code relatively small, but there’s no problem with making the list large.

    //popuplate the query
    for (local.i = 1; local.i lte arrayLen(local.items); local.i = local.i + 1){
        local.fieldList = "GivenName,Surname,FileAs,CompanyName";
        for (local.j = 1; local.j lte listLen(local.fieldList); local.j = local.j + 1){
            local.key = listGetAt(local.fieldList, local.j);
            if (structKeyExists(local.items[local.i], local.key)){
                QuerySetCell(local.emptySet, local.key, local.items[local.i][local.key].XmlText, local.i);
            }
        }
    }
    return local.emptySet;
    

    Oh, and this also assumes that the field names in your DataTable are exactly the same as the column names in the query that it’s copying them to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've the following XML output from an asp.net webservice: <ArrayOfArrayOfString> <ArrayOfString> <string>1710</string> <string>1711</string> <string>1712</string>
I am getting an object back from ASP.NET, and when tracing the XML it
Using an ajax POST request in jQuery, I get the following xml back from
From windows event viewer I can get the following xml structure: <Event xmlns=http://schemas.microsoft.com/win/2004/08/events/event> <System>
I have the following xml that I need to get 2 values (see *
I get the following text as a string from an XML-based REST API 'd':4
How can I get the connection.connection_string value from the following hibernate xml file using
I am using the following code to get an XML data from a website
I'm getting the following block of xml back from a web service: <?xml version=1.0
I'm getting the following XML-element back in an XML file. From this element I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.