Error when SOAP Request Message contains ]]>

When a SOAP object contains the characters “]]>” in the request message, the test will not run. the file will not save and will throw a java error:

11-16-2018 04:58:50 PM - [WARNING] - Cannot find test object with id ‘Object Repository/ClearCart’ because of ‘org.dom4j.DocumentException: Error on line 34 of document file:///Katalon%20Studio/Test/Object%20Repository/ClearCart.rs : The character sequence “]]>” must not appear in content unless used to mark the end of a CDATA section. Nested exception: The character sequence “]]>” must not appear in content unless used to mark the end of a CDATA section.’

The SOAP message has a CDATA section and needs to have one. This bug seems to be widespread through many applications that are built on Java.

Could you please show the content of the file:///Katalon%20Studio/Test/Object%20Repository/ClearCart.rs

Attaching the file here would be most convenient.

<soapenv:Envelope xmlns:ser=“http://xmlns.oracle.com/Enterprise/HCM/services” xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/”>

soapenv:Header

  <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

     <wsse:UsernameToken wsu:Id="UsernameToken-*****">

        <wsse:Username>*****</wsse:Username>

        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">*****</wsse:Password>

        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">*****</wsse:Nonce>

        <wsu:Created>2018-11-16T14:45:51.536Z</wsu:Created>

     </wsse:UsernameToken>

  </wsse:Security>

</soapenv:Header>

soapenv:Body

  <ser:FIU\_EDUNAV\_SC_REQ>

     <ser:AuthToken>*****</ser:AuthToken>

     <ser:ShoppingCart\_XML\_Request><!\[CDATA\[<?xml version="1.0"?>

<SCC_SC_CLEARCART_REQ xmlns=“http://xmlns.oracle.com/Enterprise/HCM/services”>

<SHOPPING_CART>

<SCC_SHOP_CART_TYPE>COURSE</SCC_SHOP_CART_TYPE>

</SHOPPING_CART>

</SCC_SC_CLEARCART_REQ>]]></ser:ShoppingCart_XML_Request>

  </ser:FIU\_EDUNAV\_SC_REQ>

</soapenv:Body>

</soapenv:Envelope>

Soap envelope contains a message which is also XML, but needs to be sent as CDATA so as to not interfere with the outer XML structure. We have tried HTML entities, but the server will not take anything else. This actually works. Katalon seems to be having an issue serializing this when running a test.

I think the SOAP Envelope document you provided above looks OK.

By googling with key “The character sequence “]]>” must not appear in content unless used to mark the end of a CDATA section”, I found the following post in the Stack Overflow.

A quote from the thread:

Looks like the problem was that the XML is not well-formed. The xmlwf utility says it was not. The error it gives is:
foo.xml:18135:65: not well-formed (invalid token) The error was not in your code. You should contact the data provider and get them to fix their XML generation.

Eduardo,

Do you find any message which indicates that the XML parser is recognizing (wrongly) that the xml document is not well-formed?

I am confused.

Which code do you actually find in your ClarCart.rs file?

The fragment escaped with \

<ser:ShoppingCart\_XML\_Request><!\[CDATA\[<?xml version="1.0"?>

or the fragment without escape by :

<ser:ShoppingCart_XML_Request><![CDATA[<?xml version="1.0"?>