Highlighted
Absent Member.
Absent Member.
357 views

In web services protocol, How to extract a element/value from CDATA tag in a xml response ?

Hi all,

 

For a web services script as a part of response validation, I need to extract a value called " Enrichment data" from the xml response however the xml tag is wrapped around by CDATA .

 

I am not able to write a xpath query to extract the value inside CDATA, as it is saved as a string.

 

 

find below the lr_xml_extract query and response xml 

 

lr_xml_extract("XML={SOAP_response}",       

    "XMLFragmentParam=OutputParam",          

  "Query=/SOAP-ENV:Envelope[1]/SOAP-ENV:Body[1]/ns1:iiProcessRequestResponse[1]/return[1]/text()[1]",

LAST );

 

I need to retreive the below values highlighted in red,

 

Also how to convert the extracted CDATA string into XML and retreive the "Enrichment Data" value ?

 

please share your thoughts

 

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1 = "http://www.insuranceinitiatives.co.uk" xmlns:xsd = "http://www.w3.org/2001/XMLSchema" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/" >

<SOAP-ENV:Body>

<ns1:iiProcessRequestResponse>

<return xsi:type = "xsd:string" ><![CDATA[<response><header><iilReference>82894591766466</iilReference><clientReference>186787716/00001</clientReference>

</header><insurer  iilReference="82894591766466">

<capstone>

<enrichmentData>30918500</enrichmentData>

<enrichmentData>02156430</enrichmentData>

</capstone>

</insurer></response>]]></return>

</ns1:iiProcessRequestResponse>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

 

 

 

 

 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.