camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajneesh <>
Subject Dynamic Data formating - REST Configuration
Date Sat, 07 Jan 2017 23:55:43 GMT

Want to expose a rest endpoint ("/v1/message" in below snippet) which has to
supports json and xml both for request & response. 
For incoming request - regardless of its Json or xml format, camel should
detect, unmarshal/convert in POJO (JAXB complient pojo -
com.corp.model.v1.MyRequest) so in route I could get MyRequest object from
exchange - its happening (based upon the content-type autometically) with
with below configuration.

For outgoing response to service - com.corp.model.v1.MyResponse is the pojo 
(jaxb complaint) which I populate with values and it setting in exchange for
out (content-type in header is being set accordingly I can see in soap ui
response header). Camel should convert this pojo based on content type to
json/xml response payload - which is not happening. every time xml payload
is coming in response not json. 

Can someone advise what I am missing here? 
Note - Pom has both camel-jackson and camel-jaxb dependencies.

<restConfiguration component="servlet">
		<rest path="/">			 
			<post uri="/v1/message" consumes="application/json,application/xml"
produces="application/json,application/xml"   bindingMode="auto"
type="com.corp.model.v1.MyRequest" outType="com.corp.model.v1.MyResponse">
			<to uri="direct:route_1" />		

			<post uri="/another_uri" bindingMode="off">
				<to uri="direct:route_2" />

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message