Apache CXF客户端未连接

时间:2016-09-07 07:16:32

标签: web-services cxf

我通过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

任何人都可以帮我吗?

1 个答案:

答案 0 :(得分:0)

您的例外情况表明您的服务正在使用soap 1.2版。

使用this link更改soap版本。