Forum Discussion

dehlers's avatar
13 years ago

CData Displayed Incorrectly

When testing a web service response, I encountered some strange behavior. There are two parts to this issue...
1) Displaying text in wrapped in CDATA that is not truly wrapped in CDATA&colon; For whatever reason I found that if I had text that contained 3 or more nodes (<html><b><i></i></b></html>) that it would automatically be wrapped in CDATA by SoapUI. Needless to say, this is misleading when you are trying to code an object that serializes an XMLCDataSection that is not working properly. Anything less than 3 nodes, would have the "<" parsed into "&lt;" - which is they way it ought to be if the response does not have the text wrapped in CDATA.

Probably more importantly:
2) When actually passing text wrapped in CDATA, SoapUI uses the same rules above when displaying the data. If it has 3 nodes, it wraps it in CDATA, if it has less than that, it doesn't wrap it in CDATA. Why this is such an issue is if you are attempting to test that the response is actually capable of passing HTML without being parsed, you cannot test it using SoapUI! The only reason I found this is because I decided to bypass SoapUI and check the response using Internet Explorer (seriously), which is fine when running locally, but not when running off a remote server, so I found that XML Spy is able to process CDATA correctly. I am able to trace the correct xml through the code all the way until it reaches SoapUI, and SoapUI is just doing its own thing to the data.

I don't wish to use XML Spy, can this be fixed in SOAPUI? If not issue #1, at least issue #2?

1 Reply

  • Those issues still apply for SOAP UI v4.6.4 Build Date: 20140110-2328.
    Both issues make SOAP UI very hard to use for testing real requests and responses created by web services and web service clients since fake CDATA sections are misleading.
    It seems like these issues are caused by "Format XML (Pretty-prints the XML)" functionality that also replaces escaped string values with CDATA sections in some situations (more than 3 tags).

    For instance the following XML sequence from a WS response message:
    <ns1:string>&lt;a href="s">&lt;/a>&lt;h1>y&lt;/h1>&lt;h1>z&lt;/h1></ns1:string>

    is converted automatically by "Format XML" into:
    <ns1:string><![CDATA[<a href="s"></a><h1>y</h1><h1>z</h1>]]></ns1:string>


    It would be great if this replace behavior of Format XML can be removed or disabled from SOAP UI global preferences.