Hi,

I have done following code and i am not getting any exception neither
request is working

My Route

             from("timer://foo?delay=0&period=20000")
                .doTry()
                        .process(new SendSmsRequest())
                        .to("http://x.x.x.x:5001/rest/sms/messages";)
                        .process(new SendSmsResponse())
                 .doCatch(Exception.class)
                     .to("mock:error")
                .doFinally()
                     .to("mock:end");

Request:

                   Message inMessage = exchange.getIn();
                   inMessage.setHeader(Exchange.HTTP_METHOD, "POST"); 
                   
inMessage.setHeader(Exchange.CONTENT_TYPE,"application/json");  
                   inMessage.setHeader("Authorization", "Basic " +
Base64Coder.encodeString("abc:xyz"));
                                   
                   String toAddress             =       "\"addresses\": 
[\"tel:1234\"]";
                   String fromAddress   =       "\"senderName\": \"tel:345\"";
                   String msg                   =       "\"message\": \"hello 
world\"";
                   
                   String sms   =       
"{"+toAddress+","+fromAddress+","+msg+"}";
                   
                   System.out.println(sms);
                   
                   inMessage.setBody(sms);

Response:

                System.out.println("in result");
                Message out = exchange.getOut();
                int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE,
Integer.class);
                System.out.println("in result"+responseCode);

I take trace and no request is going to http url,

Please let me know if i am doing some wrong

Regards





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

Reply via email to