Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

setBody(Object body, Class type) does not seem to set the body type

$
0
0
I have the following in my camel context:

<onException>
<exception>org.apache.cxf.binding.soap.SoapFault</exception>
<handled>true</handled>
<to uri="a bean that sets the body to a new string, i.e.
exchange.getIn().setBody(something, String.class)" />
<to uri="file:/..." />
</onException>

It does not matter what I set in the body (the something above), the file
would be empty. I noticed that the body type is still CxfPayload after I
did the setBody(something, String.class). However, if I add a convertBodyTo
String before the bean is called, then everything would work fine:

<onException>
<exception>org.apache.cxf.binding.soap.SoapFault</exception>
<handled>true</handled>
*<convertBodyTo type="String" />*
<to uri="a bean that sets the body to String, i.e.
exchange.getIn().setBody(something, String.class)" />
<to uri="file:/..." />
</onException>

Should setBody(something, String.class) set the body to String?

Thanks in advance for any insight.

Viewing all articles
Browse latest Browse all 5648

Trending Articles