Platinum Partner
soa,enterprise-integration,xml,tips and tricks,cdata

How to send CDATA inside your SOAP message payload

If you need to send a SOAP message payload ever and if it resulted something like this.

<task:customerSchema><ext:value>&lt;maxStops>2&lt;/maxStops></ext:value></task:customerSchema>


Because by default, a StAX parser must be in non coalescing mode (It overrides the default settings mandated by the StAX specification) and as a side effect of that parser coaelsce CDATA sections.

[1] You need to add the XMLInputFactory.properties file with the following entry to CARBON_HOME/ (root) folder.

javax.xml.stream.isCoalescing=false
For more information
[1] http://people.apache.org/~veithen/axiom/userguide/ch04.html#factory.properties

[2] http://wso2.org/forum/thread/10891

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}