Hi Michael,

I was going through our implementation and looks like in the response Exchange 
--> Out object --> there is Camel Header which has the status. 

Wasn't able to attach screenshot of my debug variables, but here it goes:

DefaultExchange --> DefaultMessage (out object)  --> CaseInsensitiveMap 
(headers object) --> CamelHttpResponseCode (property).

Regards,
Arpit.

-----Original Message-----
From: wheli [mailto:[email protected]] 
Sent: Friday, July 22, 2016 7:56 AM
To: [email protected]
Subject: HTTP POST with ProducerTemplate

Hello,

I am attempting to make an HTTP POST to an endpoint (using
"https://httpbin.org/post"; as a test), but am having trouble figuring out
how to pull the HTTP response code (200, 404, etc...). I need to use a
ProducerTemplate due to some other restrictions in my application. I looked
the camel documentation and see some examples, but nothing that really
matches what I am trying to do.  

My current code:

public void sendExchangeToEndpoint(ProducerTemplate template, Exchange
exchange, String endpoint) {
String response = template.requestBody(endpoint,
exchange.getOut().getBody(), String.class);
.....
}

This works and returns what I post (which is how httpbin works), but I am
only getting the body back as a string. What would be the best way to get
back a full exchange that would contain body, headers, etc...

Any help would be greatly appreciated. Thanks! 



--
View this message in context: 
http://camel.465427.n5.nabble.com/HTTP-POST-with-ProducerTemplate-tp5785366.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to