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
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) )
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.