Never ever do XML as string literals, as that usually will fail somewhere in the future, especially when your data itself contains characters that need to be somehow escaped.
You need to use the TDomCDATASection class for what you want. It is the Delphi wrapper around the CDATASection of an XML DOM (DOMCDATASection).
An example on how to use it to store base64 encoded data is here.
Note that you need to negotiate the character set and raw byte format (big-endian, little-endian, 8-bit, 16-bit, etc) of your string data so you can do the proper base64 encoding.
Edit:
Inserting CDATA into your SOAP response needs you to go down to the metal.
There are a couple of ways you could try:
- Create a descendant of
TOPToSoapDomConvert
- Override
TSOAPDomConv.ConvertNativeDataToSoap or TOPToSoapDomConvert.MakeResponse methods in your descendant
- Assign an instance of your
TOPToSoapDomConvert descendant to the Converter property of your THTTPRIO instance
Another way might be this one:
- Create a descendant of
TTypeTranslator
- Override
TTypeTranslator.CastNativeToSoap
- Assign an instance of your
TTypeTranslator descendant to the TypeTranslator variable in the TypeTrans unit
It is hard, don't go that way if you do not need to.
--jeroen