Forum Discussion

kvasko's avatar
kvasko
New Contributor
15 years ago

CDATA XML input seemingly being parsed incorrectly

I am using soapUI 4.0.0 Build dist-123-2011-06-14, Build Date 2011/06/14 09:52

I created a new project leaving the defaults selected. I type in the URL of the server providing the web service. I right click on the service and create a new request and this gets generated...

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fix="http://10.6.1.21:8080/Consol/FIXED_NETWORK">
<soapenv:Header/>
<soapenv:Body>
<fix:system_status>
<!--Optional:-->
<fix:SysStatusXML>
</fix:SysStatusXML>
</fix:system_status>
</soapenv:Body>
</soapenv:Envelope>

The problem exists when I try to pass XML CDATA to the webservice as below. It seems that SoapUI is parsing the greater than symbol incorrectly. The bold portion below is highlighted in red but nothing after it is (i would expect it to be). With the below I get a "400 Bad Request"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fix="http://10.6.1.21:8080/Consol/FIXED_NETWORK">
<soapenv:Header/>
<soapenv:Body>
<fix:system_status>
<fix:SysStatusXML>
<![CDATA[<SystemStatus><StartDate>20110101</StartDate><EndDate>20110625</EndDate><SiteID>36801</SiteID></SystemStatus>]]
</fix:SysStatusXML>
</fix:system_status>
</soapenv:Body>


However using &gt; and $lt; the webservice works correctly.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fix="http://10.6.1.21:8080/Consol/FIXED_NETWORK">
<soapenv:Header/>
<soapenv:Body>
<fix:system_status>
<fix:SysStatusXML>
&lt;SystemStatus&gt;&lt;StartDate&gt;20110101&lt;/StartDate&gt;&lt;EndDate&gt;20110625&lt;/EndDate&gt;&lt;SiteID&gt;36801&lt;/SiteID&gt;&lt;/SystemStatus&gt;
</fix:SysStatusXML>
</fix:system_status>
</soapenv:Body>
</soapenv:Envelope

</soapenv:Envelope>

Is there something I am overlooking? I am trying to base my example off of the SoapUI examples given here. http://www.soapui.org/Functional-Testin ... cdata.html

5 Replies

  • Finan's avatar
    Finan
    Frequent Contributor
    change: <![CDATA[<SystemStatus><StartDate>20110101</StartDate><EndDate>20110625</EndDate><SiteID>36801</SiteID></SystemStatus>]]

    into:
    <![CDATA[<SystemStatus><StartDate>20110101</StartDate><EndDate>20110625</EndDate><SiteID>36801</SiteID></SystemStatus>]]>

    And you should be fine
  • kvasko's avatar
    kvasko
    New Contributor
    That does not seem to work either.

    Here is the example of what I am talking about

    http://i.imgur.com/a7A98.jpg

    It is like soapUI is just stopping on the first ">". You can see what I mean by the image above. The CDATA data should be all in red from syntax highlighting but it stops as soon as the first ">" is found.
  • I also have the same problem. This wouldn't be too bad as replacing the tags with &lt; and &gt; works fine; however, another feature of soapUI breaks this workaround.

    Property transfer steps seem to rewrite messages for you, "correct" all the &lt; and &gt; workarounds and encapsulate everything in CDATA tags, which it then incorrectly parses.

    This has given me rage. >:(
  • Thanks Kvasko and Finan!!

    I was stuck with similar problem !! but for me both the foramts are working fine i.e.

    &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;BODY&gt;&lt;GETNIA&gt;&lt;AMO&gt;KGGRCEECX1Kx01N&lt;/AMO&gt;&lt;RESOURCETYPE&gt;1&lt;/RESOURCETYPE&gt;&lt;/GETNIA&gt;&lt;/BODY&gt;

    AND

    <![CDATA[<?xml version="1.0" encoding="UTF-8"?><BODY><GETNIA><AMO>KGGRCEECX1Kx01N</AMO><RESOURCETYPE>1</RESOURCETYPE></GETNIA></BODY>]]>