Description:
|
See attached example, it is modified camel-soap-proxy with one change - there are two Camel components instead of one that are chained.
Each component contains two log messages. The example does not work because the first camel implementation converts the message body into ByteArrayInputStream.
When the second component access the body it consumes the InputStream but the consumption is done every time the body is accessed. Unfortunately there is no reset between InputStream reads which means that the body is no longer accessible.
The log file analysis shows
First component
- body is converted to String and first message is printed
- second log message is printed
- body is converted to InputStream
- Second component is called, first log message is printed, a body is converted form InputStream to String
- second log message should be printed but body is empty
- the debugger has shown that pos is at the end of stream and it is not possible to read a body from the stream
- message trace shows empty message body
- wb service invaction fails - message payload is empty
Camel component should by default convert to a type that allows repeatable re-use.
It is possible to bypass the issue using
but this could be very hard for the user to find out.
|