camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: setBody(Object body, Class<T> type) does not seem to set the body type
Date Thu, 24 Jul 2014 09:39:47 GMT
Use a processor instead of a bean if you want to mutate the exchange,
or make the bean return exchange

On Wed, Jul 23, 2014 at 5:13 PM, bocamel <johnzyin@gmail.com> wrote:
> 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.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/setBody-Object-body-Class-T-type-does-not-seem-to-set-the-body-type-tp5754307.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message