2017-01-19 119 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網址。刪除頭文件工作:''感謝所有! –

回答