【问题标题】:How to call soap web service from camel rest java DEL如何从骆驼休息java DEL调用soap Web服务
【发布时间】:2017-03-23 10:49:19
【问题描述】:

我正在尝试从骆驼休息中调用肥皂网络服务,从 java DSL。但收到带有 500 响应代码的服务器错误。

我将收到一个带有 json 数据的休息电话,我必须调用第三方soap 服务,我还需要处理soap 响应并以json 格式发回响应。

这是我的代码

{
String getCustomerDetailsurl="http://<serverip>/webservice/Service.asmx?op=GetClientDetail&bridgeEndpoint=true";

rest("/customers")
.description("Aviva Mobile  sales customer service")
.consumes("application/json")
.produces("application/json")
 .post().type(ClientRequest.class) // incomming request data
 .route()
 .from("direct:start")
 //.setHeader(Exchange.HTTP_METHOD, constant("POST"))
  .process(new CustomerProcessor()).marshal().xstream()
.to(getCustomerDetailsurl);

错误

org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://<serverip>/webservice/Service.asmx?op=GetClientDetail with statusCode: 500
       at org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:239) ~[camel-http-2.17.5.jar:2.17.5]
       at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:161) ~[camel-http-2.17.5.jar:2.17.5]
       at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.17.5.jar:2.17.5]
       at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) ~[camel-core-2.17.5.jar:2.17.5]
       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) ~[camel-core-2.17.5.jar:2.17.5]
       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468) ~[camel-core-2.17.5.jar:2.17.5]

}

【问题讨论】:

标签: rest soap apache-camel


【解决方案1】:
  1. 您必须查看服务器端的实际错误。
  2. 您可以使用诸如 tcp 监视器 (tcpMon) 之类的工具来准确查看您发送的内容和返回的内容。
  3. 实际上,要使用 SOAP 服务,最好使用 SOAP 客户端,而不是通过 http 进行原始调用。看看 Camel-CXF 组件。然后创建一个 CXF 端点并在您的 .to({cxfEndpointUri}) 中使用它的 uri。 CXF 将为您完成所有 SOAP 工作。也许你需要在它的拦截器中做一些工作,比如如果服务器需要授权。

附:在您的代码中,您的CustomerProcessor 产生什么样的 Exchange.body?它对服务器 SOAP 信封有效吗?它是否具备服务器所要求的所有功能(WSDL)?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-07
    • 1970-01-01
    • 2019-06-29
    • 2014-01-16
    • 2013-04-03
    • 2017-03-22
    • 2014-01-19
    • 2013-12-04
    相关资源
    最近更新 更多