I'm trying to guide a colleague towards the most correct way of sending an XML document in a SOAP message, but I'm no expert on the subject. It seems like something that should be solvable using a CDATA section, but a default gSOAP serializer is 'helping' by encoding all '<' and '>'.
For example, when we try to send this:
<xml>
<tag>
<content>
<![CDATA[<xml><tag>Text!</tag></xml>]]>
</content>
</tag>
</xml>
What actually gets sent is more like this:
<xml>
<tag>
<content>
<![CDATA[<xml><tag>Text!</tag></xml>]]>
</content>
</tag>
</xml>
If the receiver was also gSOAP based we may transparently get away with that without even needing the CDATA markers, but that is not the case. The receiver is some PHP code, so using html_entity_decode may work, but it feels wrong (and perhaps wouldn't work in all cases?).
I was hoping/expecting the solution would be to specify a different type for the field (currently 'xsd:string') so that a dumber serializer got used, preserving the CDATA markers and the content within.
I'd like to avoid any in-house wheel-reinvention if there's a simple and correct way to solve this (base64 encoding the payload is being proposed).