I am running servicemix 4.4.1. I am trying to make a http call to a website by using camel-http4. No matter which website I try to invoke, I keep getting this error: org.apache.camel.RuntimeCamelException: org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http://servicemix.apache.org/downloads/servicemix-4.4.0.html with statusCode: 405
Here is my code snippet:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq://events1"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<to uri="http://servicemix.apache.org/downloads/servicemix-4.4.0.html"/>
<to uri="log:events"/>
</route>
</camelContext>
I have tried a number of sites and tried using different http methods (post vs get), and I keep getting the same error. Any idea? Thanks in advance.
The website you specified is no target of a form. So most likely it will only allow GET requests not POST. So try to set the CamelHttpMethod to GET.
Btw. what do you want to achieve with your route? If you want to send the activeMQ message to the website then POST is ok but you have to use a website that accepts POST.
You could achieve that by defining your own route to receive the request.
Then you can send to that url in the first route.