我有一条类似于以下的 Camel 路线:
<camel:routeContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="restlet:/v1/authentication/initiate?restletMethod=post&restletBinding=#queryStringToHeadersRestletBinding"/>
<to uri="http://xx.xx.xx.xx:20015/login"></to>
</route>
现在,在收到来自reSTLet的请求后,camel处理器不再访问http://xx.xx.xx.xx:20015/login
而是尝试点击http:///localhost/v1/authentication/initiate
不存在,因此我得到 404 HTTPOperation failed,如下所示:
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http://localhost/v1/authentication/initiate with statusCode: 404
at org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:228) ~[camel-http-2.12.4.jar:2.12.4]
at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:156) ~[camel-http-2.12.4.jar:2.12.4]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.12.4.jar:2.12.4]
我能够成功地使用其他地方的路线。但不知道为什么它没有到达此路由定义中的预期目标 URL。 请帮忙。
最佳答案
删除 CamelHTTP header ,reSTLet 在调用 HTTP 端点时可能会产生噪音。
请参阅此常见问题解答:http://camel.apache.org/how-to-remove-the-http-protocol-headers-in-the-camel-message.html
关于java - 无法通过 Apache Camel 访问外部 HTTP 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41746598/