Skip to main content

Preserve exchange body while calling a bean

Sometimes a java bean needs to be called, but you do not want the method response to replace the current exchange body. But using the cBean component would cause this undesired behaviour.

Therefore you should not use the cBean component (in this case), but rather a cSetHeader component. The return value of the Java bean would not change the body, but would only set a header field which could be easily ignored, while the exchange body would remain untouched.

If you need to call a specific bean method name within the cSetHeader component you can just type the method name comma separated after the bean class name (e.g: beans.MyBean, myMethod).

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!