AlexGilleran / IceSoap

Easy, asynchronous, annotation-based SOAP for Android
Other
75 stars 18 forks source link

How to create SOAP request with CDATA #15

Closed pzienowicz closed 7 years ago

pzienowicz commented 7 years ago

Hi,

Is there any way to send eg. html code in CDATA tag? When I add text node like this: `<![CDATA[

    ]]>`

The problem is: <![CDATA[ ]]> is displaying like &lt;![CDATA[ and ]]&gt;

Thanks!

AlexGilleran commented 7 years ago

I don't know of any way with the current API.

Looks like it's possible with XMLSerializer though, so it should be possible to add: https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer.html#cdsect(java.lang.String)

pzienowicz commented 7 years ago

Could you provide me any example? How can I use it with com.alexgilleran.icesoap.envelope.impl.BaseSOAP11Envelope?

AlexGilleran commented 7 years ago

I think you could create a XMLCDataNode class that extends XMLTextNode, and override serializeContent to use XMLSerializer.cdsect(getValue()) instead of XMLSerializer.text. Then you could add it to any existing envelope or XMLNode with addElement

pzienowicz commented 7 years ago

Works like a charm. Thank you @AlexGilleran!

AlexGilleran commented 7 years ago

Yay! No worries :)