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 can use extract() function if your XML needs custom manipulation for CDT formation. You will need to build one expression that can extract field values and then map them to CDT fields. Parsing logic can look like this:

    load(
      local!xml:extract(ri!xmlData,"<loc>","</loc>"),
      local!items:a!forEach(
        local!xml,
        extract(fv!item,"<data>","</data>")
      ),
      a!foreach(
        local!xml,
        {
       id:extract(fv!item,"<Id>","</Id>"),
       guid:extract(fv!item,"<guid>","</guid>"),
       dc:extract(fv!item,"<dC>","</dC>")
       })  
    )

     

    Similarly you can create logic to parse Nested Data tags and get their value.

    Hope this helps.

Reply
  • 0
    Certified Lead Developer

    You can use extract() function if your XML needs custom manipulation for CDT formation. You will need to build one expression that can extract field values and then map them to CDT fields. Parsing logic can look like this:

    load(
      local!xml:extract(ri!xmlData,"<loc>","</loc>"),
      local!items:a!forEach(
        local!xml,
        extract(fv!item,"<data>","</data>")
      ),
      a!foreach(
        local!xml,
        {
       id:extract(fv!item,"<Id>","</Id>"),
       guid:extract(fv!item,"<guid>","</guid>"),
       dc:extract(fv!item,"<dC>","</dC>")
       })  
    )

     

    Similarly you can create logic to parse Nested Data tags and get their value.

    Hope this helps.

Children
No Data