I am building a Web service using Java and Spring-ws. It is working fine, except for one thing.
When I assembly the payload to be put inside the SOAP Body, I want to include CDATA escaped strings. This is how I want the result to look like:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://example.com/ns">
<soapenv:Header/>
<soapenv:Body>
<_0:Message>
<_0:StringPayload><![CDATA[<myxml>stuff</myxml>]]></_0:StringPayload>
</_0:Message>
</soapenv:Body>
</soapenv:Envelope>
However, Spring-WS seems to tamper with the payload when it adds the SOAP envelope. This is the result I get:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://example.com/ns">
<soapenv:Header/>
<soapenv:Body>
<_0:Message>
<_0:StringPayload><myxml>stuff</myxml></StringPayload>
</_0:Message>
</soapenv:Body>
</soapenv:Envelope>
Is there a way to make sure Spring WS does not escape XML characters and respect the CDATA tag?
I am using Spring WS together with Apache Camel, so a solution where I do not have to alter/extend the spring-ws classes would be prefered.
I have used MOXy and @XmlCDATA annotation to generate CDATA content, and experiments have shown that AxiomSoapMessageFactory reaplces it with escaped XML content (although Jaxb2Marshaller seems to produce correct CDATA stuff).
However, it works just fine with SaajSoapMessageFactory.