2017-01-19 65 views
0

我具有类似于骆驼路线击中外部HTTP服务:不能够通过Apache骆驼

<camel:routeContext xmlns="http://camel.apache.org/schema/spring"> 
<route> 
    <from uri="restlet:/v1/authentication/initiate?restletMethod=post&amp;restletBinding=#queryStringToHeadersRestletBinding"/> 
    <to uri="http://xx.xx.xx.xx:20015/login"></to> 
</route> 

现在,接收来自的Restlet请求,骆驼处理器,而不是去http://xx.xx.xx.xx:20015/login尝试后打http://localhost/v1/authentication/initiate不存在,因此我得到404 HTTPOperation失败,如:

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] 

我能在其他地方使用的路由SUCC essfully。但不知道它为什么没有在这个路由定义中达到预期的目标网址。 请帮忙。

+0

你有没有在路由之前设置的'Exchange.HTTP_URI'头?或者也许这就是Restlet正在做的事情?这将覆盖路由中给出的URI的值 –

+0

删除CamelHTTP头,当调用HTTP端点时,该头可能会引起噪音。看到这个常见问题:http://camel.apache.org/how-to-remove-the-http-protocol-headers-in-the-camel-message.html –

+0

是的CamelHTTPHeader是造成指向的问题restlet网址。删除头文件工作:''感谢所有! –

回答