-
Bug
-
Resolution: Won't Do
-
Minor
-
jboss-fuse-6.2.1
-
None
-
%
I have created a simple project to call a REST endpoint exposed by CXF
<cxf:rsServer id="customerRestService" address="http://localhost:9191/rest" serviceClass="org.fuse.usecase.service.CustomerRest" loggingFeatureEnabled="false"> <cxf:providers> <ref bean="jsonProvider"/> </cxf:providers> </cxf:rsServer> <cxf:rsClient id="customerRestServiceClient" address="http://localhost:9191/rest" loggingFeatureEnabled="true" serviceClass="org.fuse.usecase.service.CustomerRest"> <cxf:providers> <ref bean="jsonProvider"/> </cxf:providers> </cxf:rsClient> <bean id="customerRestImplBean" class="org.fuse.usecase.service.CustomerRestImpl"/>
When the Camel CXF producer calls the REST endpoint it gets a correct response as reported by the out interceptor of CXF
ID: 1 Response-Code: 200 Encoding: ISO-8859-1 Content-Type: application/json Headers: {content-type=[application/json], Date=[Thu, 10 Dec 2015 17:18:01 GMT], Server=[Jetty(8.1.17.v20150415)], transfer-encoding=[chunked]} Payload: {"company":{"name":"Robocops","geo":"NORTH_AMERICA","active":true},"contact":{"firstName":"Bill","lastName":"Smith","streetAddr":"100 N Park Ave.","city":"Phoenix","state":"AZ","zip":"85017","phone":"602-555-1100"},"clientId":0,"salesRepresentative":null}
But if I try to log the output received as you can see within the Camel Route ("REST IN result") and ("REST OUT result")
<from uri="file:{{fileOutput}}"/> <convertBodyTo type="String"/> <unmarshal> <json library="Jackson" unmarshalTypeName="org.globex.Account"/> </unmarshal> <setHeader headerName="Content-Type"> <constant>application/json</constant> </setHeader> <setHeader headerName="Accept"> <constant>application/json</constant> </setHeader> <setHeader headerName="CamelHttpMethod"> <constant>POST</constant> </setHeader> <setHeader headerName="CamelHttpPath"> <constant>/customerservice/enrich</constant> </setHeader> <setHeader headerName="CamelCxfRsUsingHttpAPI"> <constant>true</constant> </setHeader> <to uri="cxfrs:bean:customerRestServiceClient"/> <log message=">> REST IN result : ${in.body.company.name}, ${in.body.company.geo}"/> <log message=">> REST OUT result : ${out.body}"/> </route> <!-- REST Service --> <route> <from uri="cxfrs:bean:customerRestService"/> <transform> <method ref="customerRestImplBean" method="enrich"/> </transform> </route>
The Exchange out is null and the body of the in contains the original Account object and not the response
Camel (camel-1) thread #1 - file://src/data/outbox INFO [route2] - >> REST IN result : Robocops, NA Camel (camel-1) thread #1 - file://src/data/outbox INFO [route2] - >> REST OUT result :