I have a JAX-WS Web-Service which accepts some basic data and a String which is supposed to contains the content of a whole XML file. In the first time I though I can just put this XML in my SOAP request as a CDATA section like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
...
<contentData>
<![CDATA[
<my>
<xml>
<here>
...
</here>
</xml>
</my>
]]>
</contentData>
...
</soapenv:Body>
</soapenv:Envelope>
But the issue is that my XML data contains as well some CDATA sections and it is not working like this as nested CDATA are not allowed (W3School reference).
What would be the best practice to send such data?
<
and
>
(among others)I saw this question but serialising the Java object is not an option as the XML data are generated by another side.
I definitely prefer Solution 2, encoding and decoding Base64 formats.