How to convert xml response to a CDT

Hi all,

We are trying to invoke a SOAP service which is having an issue while trying to use "Call Web Service"

Hence, we have used "Integration" object to call the endpoint with content type as text/xml.

We are able to invoke the "Integration" object as expected and also getting the response as soap xml.

Can any one suggest on how to convert the returned soap xml into a custom CDT.

Thanks,

Phani

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You will need to manually parse the string and create a CDT using the type cast function. Example type!myCDT(fieldA: "fieldValue", fieldB: 1). You can use a combination of the search() and mid() functions or xpathsnippet(). It might look something like:

    load(
        local!xmlResponse: rule!yourIntegration(),
        local!fieldA: xpathsnippet(\*Parsing Logic goes here*\),
        local!fieldB: xpathsnippet(\*Parsing Logic goes here*\),
        type!myCDT(fieldA: local!fieldA, fieldB: local!fieldB)
    )

  • Hi Josh,
    This is a sample of my output.

    <loc> and <data> elements are repeating.

    "<soap:Envelope xmlns:soap="schemas.xmlsoap.org/.../">
    <soap:Body>

    <LL xmlns="schemas.xxx.com/.../">

    <loc>

    <Id>1234</Id>
    <guid>g1</guid>
    <dC>CC</dC>

    <data>
    <key>Creator</key>
    <value>OK</value>
    <type>STRING</type>
    </data>

    <data>
    <key>DateCreated</key>
    <value>06/21/2000</value>
    <type>DATE</type>
    </data>

    <data>
    <key>IsTrue</key>
    <type>BOOLEAN</type>
    <value>true</value>
    </data>

    </loc>

    <loc>

    <Id>1111</Id>
    <guid>g2</guid>
    <dC>CC1</dC>

    <data>
    <key>Creator</key>
    <value>OK1</value>
    <type>STRING</type>
    </data>

    <data>
    <key>DateCreated</key>
    <value>06/21/2008</value>
    <type>DATE</type>
    </data>

    <data>
    <key>IsTrue</key>
    <type>BOOLEAN</type>
    <value>true</value>
    </data>

    </loc>

    </LL>

    </soap:Body>
    </soap:Envelope>"

    Please provide your inputs.
Reply
  • Hi Josh,
    This is a sample of my output.

    <loc> and <data> elements are repeating.

    "<soap:Envelope xmlns:soap="schemas.xmlsoap.org/.../">
    <soap:Body>

    <LL xmlns="schemas.xxx.com/.../">

    <loc>

    <Id>1234</Id>
    <guid>g1</guid>
    <dC>CC</dC>

    <data>
    <key>Creator</key>
    <value>OK</value>
    <type>STRING</type>
    </data>

    <data>
    <key>DateCreated</key>
    <value>06/21/2000</value>
    <type>DATE</type>
    </data>

    <data>
    <key>IsTrue</key>
    <type>BOOLEAN</type>
    <value>true</value>
    </data>

    </loc>

    <loc>

    <Id>1111</Id>
    <guid>g2</guid>
    <dC>CC1</dC>

    <data>
    <key>Creator</key>
    <value>OK1</value>
    <type>STRING</type>
    </data>

    <data>
    <key>DateCreated</key>
    <value>06/21/2008</value>
    <type>DATE</type>
    </data>

    <data>
    <key>IsTrue</key>
    <type>BOOLEAN</type>
    <value>true</value>
    </data>

    </loc>

    </LL>

    </soap:Body>
    </soap:Envelope>"

    Please provide your inputs.
Children
No Data