Enterprise Integration Zone is brought to you in partnership with:

At present I am a Software Engineer at WSO2.I was an undergraduate in University of Moratuwa Sri Lanka and a Young Innovator alumnus at International Communication Union (UN specialized agency).I was a Google Summer of code student for 2010 and 2011 and elected as an Apache Committer for Apache Roller.My key interests are Distributed Systems and SOA related technologies. Shelan is a DZone MVB and is not an employee of DZone and has posted 11 posts at DZone. You can read more from them at their website. View Full User Profile

How to send CDATA inside your SOAP message payload

03.27.2013
| 2714 views |
  • submit to reddit

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 Shelan Perera, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)