我想使用 apache 骆驼路由发出 SOAP 请求。我试过 cxf、http4、netty4-http。没有任何工作。我想要类似的东西
from("direct:start")
.to(myEndpoint)//should make soap call
.process(new Processor(){
public void process(Exchange e){
Log.debug(exchange.getIn().getBody().toString());//Should print returned value
}
})
我尝试过的包括
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="wsClient">
<from uri="direct:start" />
<to
uri="cxf:bean:productServiceEndpoint" />
</route>
</camelContext>
<cxf:cxfEndpoint id="productServiceEndpoint"
address="http://www.webservicex.com/country.asmx" wsdlURL="http://www.webservicex.com/country.asmx?wsdl" />
这表示需要 serviceClass。我不明白。我正在消费它。为什么我需要服务类?
下一个:
from("direct:start")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// TODO Auto-generated method stub
exchange.getOut().setBody(
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:web=\"http://www.webserviceX.NET\"> <soap:Header/> <soap:Body> <web:GetCountries/> </soap:Body></soap:Envelope>");
}
})
.to("http4://www.webservicex.com/country.asmx")
.process(new Processor(){
@Override
public void process(Exchange exchange) throws Exception {
// TODO Auto-generated method stub
System.out.println(""+exchange.getExchangeId());
System.out.println(""+exchange.getIn().getBody());
System.out.println(""+exchange.getIn().getBody());
}
})
这和 netty4-http 不会生成任何东西。