Forum Discussion

rkkandah's avatar
rkkandah
Occasional Visitor
4 years ago

How to understand what is causing SoapUI to add a CDATA wrapper?

I am using SoapUI to do a GET against a REST based API.  SoapUI is wrapping the entire response in a CDATA wrapper.  The raw data does not have this wrapper nor is it present when calling the API using a tool such as Postman or CURL.

 

How can I either find out what element SoapUI is identifying as unparsable or is there an option to disable the the CDATA wrapper all together?

 

I don't see any unescaped special characters in the response back such as & > < etc.

1 Reply

  • richie's avatar
    richie
    Community Hero

    Hey rkkandah 

     

    Just to be clear.  Your responses RAW does NOT include the CDATA wrapper, but the XML tab does include content wrapped within the CDATA tag handler.  Is that correct?

     

    Have you tried toggling the pretty print responses checkbox option in your WSDL preferences?  (e.g. Preferences >> WSDL >> 'Pretty Print response messages')  Before now, I've seen escaped XML present as CDATA wrapped XML for a response and toggling the switch might reveal something.  When I saw this when the switched was set to true, the response content appeared as: 

    <![CDATA[<Output>
    <Parent>
    <Child1>value1</Child1>
    <Child2>value2</Child2>
    </Parent>
    </Output>]]>

     

    When I toggled the checkbox to false, the response then appeared as follows: 

    &lt;Output&gt;
    &lt;Parent&gt;
    &lt;Child1&gt;value1&lt;/Child1&gt;
    &lt;Child2&gt;value2&lt;/Child2&gt;
    &lt;/Parent&gt;
    &lt;/Output&gt;

     

    thatis, toggling the switch revealed the content was actually escaped XML and did NOT in fact have a CDATA wrapper - it was just ReadyAPI! was presenting like this.

     

    I understand our issues are different, but at least this would reveal the 'actual' details which should then match your RAW details exactly.

     

    Once you've checked the pretty print option, I'd copy the content of the RAW out from SoapUI and paste into something like XMLSpy.  Id suggest using a tool like XMLSpy rather than just picking something with an XML parser (like a browser) as its a lot more helpful.

     

    At this point I'd consider the char set (the character encoding definition in your XML declaration (within the XML Prolog) and then do a wellformed check against the content of the XML.  

     

    Something in the response content is encouraging SoapUI to treat the response content like character data - after you've toggled the switch I'd then look at the content itself (just in case its something stupid like escaped XML).  just cos you cant see any of the 5 XML entities escaped (<,>,",', or &) doesn't mean there arent any other 'dodgy' characters (probably beginning with an ampersand - e.g. &nbsp; etc.) that won't help your situation - but having these additional characters would be unlikely to force the inclusion of the CDATA wrapper into yoru response without you expecting it.

     

     

    Please respond with your investigation - I'm intrigued to know what the issue actually is

     

    nice one

     

    rich

     

     

    \z