Non-escaping characters in Spring WS SOAP body

I am creating a web service using Java and Spring-ws. It works fine, except for one.

When I collect the payload that will be placed inside the SOAP body, I want to include CDATA escape lines. This is how I want the result to look like this:

<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 interfere with the payload when it adds a SOAP envelope. As a 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>&lt;myxml>stuff&lt;/myxml></StringPayload>
 </_0:Message>
</soapenv:Body>
</soapenv:Envelope>

Is there a way to make sure Spring WS doesn't escape XML characters and respects the CDATA tag?

I use Spring WS along with Apache Camel, so a solution in which I don't need to modify / extend Spring -ws classes would be preferable.

+3
source share
1 answer

MOXy @XmlCDATA- CDATA, , AxiomSoapMessageFactory XML- ( Jaxb2Marshaller, , CDATA).

SaajSoapMessageFactory.

+2

All Articles