emm*_*219 7 apache-camel http-status-code-405 apache-servicemix
我正在运行 servicemix 4.4.1。我正在尝试使用camel-http4 对网站进行http 调用。无论我尝试调用哪个网站,我都会收到此错误: org.apache.camel.RuntimeCamelException: org.apache.camel.component.http.HttpOperationFailedException: HTTP 操作失败调用http://servicemix.apache.org/downloads /servicemix-4.4.0.html状态代码:405
这是我的代码片段:
<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>
Run Code Online (Sandbox Code Playgroud)
我尝试过许多网站并尝试使用不同的 http 方法(post 与 get),但我不断收到相同的错误。任何想法?提前致谢。
您指定的网站不是表单的目标。所以很可能它只允许 GET 请求而不是 POST。所以尝试将CamelHttpMethod设置为GET。
顺便提一句。您想通过您的路线实现什么目标?如果您想将 activeMQ 消息发送到网站,那么 POST 就可以,但您必须使用接受 POST 的网站。
您可以通过定义自己的接收请求的路由来实现这一点。
然后您可以发送到第一个路由中的该网址。
| 归档时间: |
|
| 查看次数: |
12854 次 |
| 最近记录: |