如果我从web服务创建一个路由,也可以。
谁能解释一下为什么下面的路由只是阻塞?
from("restlet:http://127.0.0.1:8081/nextbus/test")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.to("http://webservices.nextbus.com/service/publicXMLFeed?command=routeList&a=charm-city")
.process(new Processor() {
public void process(Exchange arg0) throws Exception {
// Do more stuff.
}
});
如果我删除调用来调用下一个总线web服务,那么一切都很好。
经过一些痛苦的调试后解决了这个问题。
看起来rest头干扰了http头。
<route>
<from uri="restlet:http://0.0.0.0:8081/nextbus/{agency}/{command}" />
<setHeader headerName="CamelHttpMethod">
<constant>GET</constant>
</setHeader>
<removeHeader headerName="CamelHttpUri" />
<recipientList>
<simple>http://webservices.nextbus.com/service/publicXMLFeed?command=${header.command}&a=${header.agency}</simple>
</recipientList>
</route>