Synapse seems to replace CDATA sections in incoming messages by text nodes. Why does this happen?

Woodstox, the XML parser used by Synapse, by default works in coalescing mode, implying that adjacent CDATA sections and text nodes are combined and reported as a single CHARACTER event. Therefore information about CDATA sections is lost. Note that enabling coalescing by default is contrary to the StAX specifications and this is a bug in the Woodstox version used by Synapse.

Starting with version 1.2.9, Axiom has a feature that allows to control the settings of the underlying StAX implementation (see the Javadoc of the StAXUtils class for more details). This can be used to switch off coalescing, so that CDATA sections will be preserved. To achieve this, create an file with the following content:

This file needs to be placed in the classpath of Synapse. For a standalone deployment, the right place is the lib directory and for a WAR deployment, place the file into WEB-INF/classes. Since Synapse 1.3 only ships with Axiom 1.2.8, you will also have to replace the corresponding JARs by newer versions. Note that at the time of writing, Axiom 1.2.9 has not yet been released and the required feature is only available in snapshot versions of Axiom.