Search code examples
xmlapache-camelcxf

How to prevent CXF from converting %gt; to > in payload?


I have a camel adapter with a CXF enpoint for the input (from) that is configured like this:

  <camel-cxf:properties>
    <entry key="dataFormat" value="PAYLOAD"/>
    <entry key="allowStreaming" value="true"/>
    <entry key="relayHeaders" value="false"/>
  </camel-cxf:properties>

The SOAP input contains the following element in the payload:

<foo>here is an arrow -&gt;</foo>

However the output looks like this:

<foo>here is an arrow -></foo>

I know it's not invalid. XML does not require to escape >. It is "only" highly recommended (see this SO question for details).

But I do not want the payload being altered. CXF should only cut off the SOAP envelope and keep everything in it as it was. Can I disable parsing/re-serialization of the XML payload?


Solution

  • A colleague of mine found out, that the problem seems to be how other components work with CXF's CachedCxfPayload output object. The processor that comes after CXF seems to do the unwanted conversion.

    Our solution is to convert CXF's output into a string before passing it on:

    <convertBodyTo type="java.lang.String"/> 
    

    Now there's no conversion anymore.