I tried producerTemplate for bean approach (in groovy) too. I got exception when I tried to POST to an HTTP endpoint: def template = context.createProducerTemplate()
def endpointUri = headers.END_POINT def xheaders = ["Content-Type":"application/json", "CamelHttpMethod":"POST"] def xbody ='''{"id":["48792683442"],"index":"0"}''' def response = template.requestBodyAndHeaders(endpointUri, xbody, xheaders, java.lang.String.class) exchange.in.setBody(response) the exception is: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {"id":["48792683442"],"index":"0"}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1237)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:509)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:442)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:247)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:296)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:292)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:329)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.ProducerTemplate$requestBodyAndHeaders.call(Unknown Source) I changed to use template.sendBodyAndHeaders(endpointUri, xbody, xheaders) in case the result is causing problem, I got same exception. Can anybody help to use producerTemplate to POST/PUT/DELETE HTTP request? It should not be limited to do only GET, isn't it? no document says anything about setting HTTP methods for producerTemplate. It would be tedious to write my own httpClient based code. -- View this message in context: http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142p5725201.html Sent from the Camel - Users mailing list archive at Nabble.com.