【问题标题】:Apache CXF Client is not connectingApache CXF 客户端未连接
【发布时间】:2016-09-07 07:16:31
【问题描述】:

我通过 apache cxf 3.1.7 版提供的 wsdl2java 实现了 Web 服务客户端。我无法附加 wsdl 文件,因为它太大了。当我执行客户端时,我收到如下错误消息。

Sep 07, 2016 9:38:27 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://service.business.tfs.kes.com}updateService#{http://service.business.tfs.kes.com}saveOrUpdateISINByPara has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://schemas.xmlsoap.org/soap/envelope/}Envelope found.   Expected {http://service.business.tfs.kes.com}saveOrUpdateISINByParaResponse.
    at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
    at com.sun.proxy.$Proxy41.saveOrUpdateISINByPara(Unknown Source)
Disconnected from the target VM, address: '127.0.0.1:35342', transport: 'socket'
    at com.cal.common.webservice.UpdateServicePortType_UpdateServiceHttpEndpoint_Client.main(UpdateServicePortType_UpdateServiceHttpEndpoint_Client.java:73)

Exception in thread "main" javax.xml.ws.http.HTTPException
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:153)
    at com.sun.proxy.$Proxy41.saveOrUpdateISINByPara(Unknown Source)
    at com.cal.common.webservice.UpdateServicePortType_UpdateServiceHttpEndpoint_Client.main(UpdateServicePortType_UpdateServiceHttpEndpoint_Client.java:73)
Caused by: org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://schemas.xmlsoap.org/soap/envelope/}Envelope found.   Expected {http://service.business.tfs.kes.com}saveOrUpdateISINByParaResponse.
    at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
    ... 2 more

我直接使用从 apache cxf wsdl2java 生成的类和测试类。我无权更改远程 Web 服务。

当我搜索时,我发现下面的链接,但它是用于服务器的。 CXF 2.7.7 org.apache.cxf.interceptor.Fault: Unexpected element

谁能帮我解决这个问题?

【问题讨论】:

  • 可能您需要检查 SOAP 版本。看起来 SOAP 版本是 1.2。在消费者客户端尝试将肥皂版本设为 1.2。
  • 实际上发生的事情是相反的。客户端发送肥皂包装,但服务器不期望它。我可以在哪里改变它。
  • 你能提供一些关于你的肥皂客户端的细节吗?
  • 这是 cxf 自动生成的 Web 服务客户端代码。

标签: web-services cxf


【解决方案1】:

您的异常表明您的服务正在等待soap 1.2版。

使用this link 更改soap 版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-12
    • 2017-06-13
    • 1970-01-01
    • 1970-01-01
    • 2017-02-18
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    相关资源
    最近更新 更多