Topic
  • No replies
samuels
samuels
64 Posts

Pinned topic Issue when parsing the CDATA

‏2013-12-31T17:46:25Z |

Hi All,

I have a scenario that to create a XML and then creating a CDATA section by using that XML, I'm logging the soap request in system logs but its giving me &lt; instead of '<'.

Step1:First.xsl

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:soap="http://www.w3.org/2003/05/soap-envelope"xmlns:dp="http://www.datapower.com/extensions"extension-element-prefixes="dp soap"exclude-result-prefixes="dp soap">

<xsl:outputmethod="xml"encoding="UTF-8"indent="yes"cdata-section-elements="Request"/>

<xsl:templatematch="/">

<xsl:variablename="XML">

<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

</xsl:variable>

<xsl:variablename="Serialized_XML">

<dp:serializeselect="$XML"omit-xml-decl="yes"/>

</xsl:variable>

<soapenv:Envelopexmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header/>

<soapenv:Body>

<Requestxsi:type="xsd:string">

<xsl:value-ofselect="$Serialized_XML"/>

</Request>

</soapenv:Body>

</soapenv:Envelope>

</xsl:template>

</xsl:stylesheet>

 

Second.xsl

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:fo="http://www.w3.org/1999/XSL/Format"xmlns:dp="http://www.datapower.com/extensions"exclude-result-prefixes="fo dp"extension-element-prefixes="fo dp">

<xsl:outputmethod="xml"omit-xml-declaration="yes"/>

<xsl:templatematch="/">

<xsl:variablename="input">

<xsl:copy-ofselect="."/>

</xsl:variable>

<xsl:messagedp:priority="error">input: <xsl:copy-ofselect="$input"/>

</xsl:message>

<xsl:copy-ofselect="$input"/>

</xsl:template>

</xsl:stylesheet>

Step3:

im doing loopback so that i can know what is the request generated to go to the backend. when i requesting from the SoapUI, I'm getting the soap request with a cdata section tags as given below.

 

<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Header/>

<soapenv:Body>

<Requestxsi:type="xsd:string"><![CDATA[<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>]]></Request>

</soapenv:Body>

</soapenv:Envelope>

 

Here, if i just copy the response and send it from the SoapUI its working fine. But inside the datapower i'm getting the &lt; instead of '<'.

Here, My question is in step 2, I am logging the message of the input. in logs its showing me like the following,

log message: input: <soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><Requestxsi:type="xsd:string">&lt;note>&lt;to>Tove&lt;/to>&lt;from>Jani&lt;/from>&lt;heading>Reminder&lt;/heading>&lt;body>Don't forget me this weekend!&lt;/body>&lt;/note></Request></soapenv:Body></soapenv:Envelope>

Could anybody help me how can i replace the &lt; into '<'.Inside the <Request>nodeset is a CDATA.  

Thanks

R@j

 

 

 

Updated on 2013-12-31T17:58:38Z at 2013-12-31T17:58:38Z by samuels