[ 
https://issues.apache.org/jira/browse/CAMEL-9864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15239055#comment-15239055
 ] 

Akitoshi Yoshida commented on CAMEL-9864:
-----------------------------------------

Hi Christian,
could it be because the stream is consumed by the converter and the resulting 
string is not set to the body? Hence the body is empty?

That means, the problem should be solved when either activating the 
stream-caching or setting back the extracted string body in the processor?
In your test case, I modified your code like this
            public void process(Exchange exchange) throws Exception {
                String strbody = exchange.getIn().getBody(String.class);
                exchange.getIn().setBody(strbody);
            }
        })
and I am getting the body (with a small difference to the original expected 
payload, as the soap-ns is reinserted to the payload as the extracted string 
payload inserts the ns declarations from its ancestor elements.)
    private static final String EXPECTED_NSADDED = "<soap:Envelope 
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";><soap:Body><ser:DemoServiceOperationResponse
 xmlns:ser=\"http://www.talend.org/service/\"; 
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>    <out>response from 
cxf 
server</out></ser:DemoServiceOperationResponse></soap:Body></soap:Envelope>";




> Calling getBody(String.class) can break a simple Camel CXF proxy route
> ----------------------------------------------------------------------
>
>                 Key: CAMEL-9864
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9864
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.16.3
>            Reporter: Christian Schneider
>            Assignee: Akitoshi Yoshida
>             Fix For: 2.16.4
>
>
> A simple CXF proxy route like this works:
>         
> from("cxf://http://localhost:8122/myservice_proxy?dataFormat=PAYLOAD&wsdlURL=classpath:/DemoService_0.1.wsdl";)
>             
> .to("cxf://http://localhost:8121/myservice?dataFormat=PAYLOAD&wsdlURL=classpath:/DemoService_0.1.wsdl";)
> If you add a processor that simply reads the body then resulting route above 
> will always return an empty body:
>             .process(new Processor() {
>                 
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                     exchange.getIn().getBody(String.class);
>                 }
>             })
> I suspect this is a bug in the new stream caching as the code works in camel 
> 2.15.x and the main difference in 2.16 is the added CachedCxfPayload.
> I will add a small github repo that shows the issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to