Hi Willem 

Thanks for the response. Am able to get the response, after I changed the code. 
In the body "exchange.getIn().getBody()", I don't get anything. Can you please 
let me know on how do I get a JSON response ? Am not able to get a good 
material for this in internet too.

Thanks in advance


________________________________
 From: Willem.Jiang [via Camel] <ml-node+s465427n5723270...@n5.nabble.com>
To: Bala <vbal...@yahoo.co.in> 
Sent: Tuesday, 27 November 2012 10:47 AM
Subject: Re: Camel for Rest Service
 

If you are using the processor to handle the response message you need to take 
the in message instead of take the out message. 
As Camel Pipeline will copy the out message of previous exchange to the next 
exchange in message. 

-- 
Willem Jiang 

Red Hat, Inc. 
FuseSource is now part of Red Hat 
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English) 
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) 
Twitter: willemjiang 
Weibo: willemjiang 





On Tuesday, November 27, 2012 at 12:09 PM, Bala wrote: 


> Hi, 
> 
> I am new to Apache camel and trying to Configure camel for invoking a rest 
> webservice and getting a response in JSON and type cast it. I tried the 
> following but, am not able to get the response anywhere. 
> 
> Had the configuration file "camel-context.xml" as 
> 
> ------------------------------------------ 
> <cxf:rsClient id="signOnRsClient" 
> address="http://158.151.224.44:8080/organizations?match&amp;CountryISOAlpha2Code=GB&amp;CustomerReferenceText=REFTEXT&amp;DUNSNumber=210021531";
>  
> /> 
> <route streamCache="true"> 
> <from uri="direct:cafe" /> 
> <log message="****************Sign ON Request Fired************" /> 
> <bean ref="signOnRequestHandler" /> 
> <to uri="cxfrs://bean://signOnRsClient"/> 
> <bean ref="signOnResponseHandler" /> 
> ------------------------------------------ 
> 
> In signOnRequestHandler, I had the following lines for appending the request 
> parameters 
> 
> ------------------------------------------ 
> public void process(Exchange exchange) throws Exception { 
> @SuppressWarnings("unchecked") 
> Message inputMessage = exchange.getIn(); 
> inputMessage.setHeader("x-dnb-user", "uatuser1"); 
> inputMessage.setHeader("x-dnb-pwd", "password-1"); 
> } 
> ------------------------------------------ 
> 
> I had main java file , where am trying to invoke the from:uri for initiating 
> the rest action as below 
> 
> ------------------------------------------ 
> 
> public static void main(String[] args) throws Exception { 
> AbstractApplicationContext applicationContext; 
> ProducerTemplate template; 
> applicationContext = new 
> ClassPathXmlApplicationContext("camelcontext.xml"); 
> CamelContext camelContext = 
> applicationContext.getBean("camelContext", CamelContext.class); 
> template = camelContext.createProducerTemplate(); 
> template.sendBody("direct:cafe", ExchangePattern.InOut); 
> } 
> ------------------------------------------ 
> 
> In the response, am not able to figure out on how to process it. The 
> response handler is as below 
> 
> ------------------------------------------ 
> public void process(Exchange exchange) throws Exception { 
> System.out.println("--->" + exchange.getOut().getHeaders().toString()); 
> System.out.println("--->" + exchange.getOut()); 
> ------------------------------------------ 
> 
> I might have done something wrong in the above things, which am unaware. 
> Please guide me on how to resolve this. 
> 
> Thanks, Bala 
> 
> 
> 
> -- 
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-for-Rest-Service-tp5723267.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com). 




________________________________
 
If you reply to this email, your message will be added to the discussion 
below:http://camel.465427.n5.nabble.com/Camel-for-Rest-Service-tp5723267p5723270.html
 
To unsubscribe from Camel for Rest Service, click here.
NAML



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-for-Rest-Service-tp5723267p5723273.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to