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).



Reply via email to