You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rajneesh <hi...@gmail.com> on 2017/01/07 23:55:43 UTC

Dynamic Data formating - REST Configuration

Hi,

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">
         </restConfiguration>
		<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>

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






--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Data-formating-REST-Configuration-tp5792280.html
Sent from the Camel - Users mailing list archive at Nabble.com.