待大侠帮忙解决CXF客户端报错,unwinding now "http://schemas.xmlsoap.org/wsdl/", the namespace.

film911 2012-11-18 06:19:06
在下在用cxf客户端测试mule的cxf服务端,报一下错误,因为我是第一次用cxf,所以请各位大侠帮帮忙给看一下,异常信息如下:客户端代码片段如下:

JaxWsProxyFactoryBean jaxFactory = new JaxWsProxyFactoryBean();
jaxFactory.setAddress("http://localhost:8081/test/test/TestSOAP?wsdl");
jaxFactory.setServiceClass(ITestService.class);
ITestService test = (ITestService)jaxFactory.create();
String returnxml = test.getXMLString("xml");
System.out.println("结果:"+returnxml);

ITestService代码如下:

@WebServicepublic
interface ITestService {
@WebMethod String
getXMLString(@WebParam(name = "xml")String xml);
}

异常如下:
2012-11-18 17:47:27 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
信息: Interceptor has thrown exception, unwinding now "http://schemas.xmlsoap.org/wsdl/", the namespace on the "definitions" element, is not a valid SOAP version.
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: "http://schemas.xmlsoap.org/wsdl/", the namespace on the "definitions" element, is not a valid SOAP version.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at $Proxy37.getXMLString(Unknown Source)
at com.jit.test.soap.test.main(test.java:17)
Caused by: org.apache.cxf.binding.soap.SoapFault: "http://schemas.xmlsoap.org/wsdl/", the namespace on the "definitions" element, is not a valid SOAP version.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:95)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:57)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2102)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1980)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1905)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 2 more
...全文
7281 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
令狐-少侠 2015-05-13
  • 打赏
  • 举报
回复
把地址修改:String address="http://192.168.1.142:9000/TestServices 去掉后面的?wsdl
wenjie4892543 2013-11-27
  • 打赏
  • 举报
回复
wenjie4892543 2013-11-27
  • 打赏
  • 举报
回复
上面的 我现在 遇到的 问题跟你一样,,,你的 一年时间 过去了 怎么解决的 ? 求 指导
引用
http://bbs.csdn.net/topics/390654139?page=1#post-396195847
回答 下 3Q!!
film911 2012-11-19
  • 打赏
  • 举报
回复
补充,如下方式访问成功,可是这与上面的方式不同之处是什么,为什么不同? JaxWsProxyFactoryBean jaxFactory = new JaxWsProxyFactoryBean(); jaxFactory.getInInterceptors().add(new LoggingInInterceptor()); jaxFactory.getOutInterceptors().add(new LoggingOutInterceptor()); jaxFactory.setServiceClass(ITestService.class); jaxFactory.setAddress("http://localhost:8081/test/test/TestSOAP"); ITestService test = (ITestService)jaxFactory.create(); String returnxml = test.getXMLString("xml"); System.out.println("结果:"+returnxml);
film911 2012-11-18
  • 打赏
  • 举报
回复
重贴一下 <?xml version="1.0" encoding="UTF-8"?> -<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://soap.test.jit.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" targetNamespace="http://soap.test.jit.com/" name="TestService"> -<wsdl:types> -<xs:schema xmlns:tns="http://soap.test.jit.com/" targetNamespace="http://soap.test.jit.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="unqualified"> <xs:element name="getXMLString" type="tns:getXMLString"/> <xs:element name="getXMLStringResponse" type="tns:getXMLStringResponse"/> -<xs:complexType name="getXMLString"> -<xs:sequence> <xs:element name="xml" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> -<xs:complexType name="getXMLStringResponse"> -<xs:sequence> <xs:element name="returnxml" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> -<wsdl:message name="getXMLStringResponse"> <wsdl:part name="parameters" element="tns:getXMLStringResponse"> </wsdl:part> </wsdl:message> -<wsdl:message name="getXMLString"> <wsdl:part name="parameters" element="tns:getXMLString"> </wsdl:part> </wsdl:message> -<wsdl:portType name="ITestService"> -<wsdl:operation name="getXMLString"> <wsdl:input name="getXMLString" message="tns:getXMLString"> </wsdl:input> <wsdl:output name="getXMLStringResponse" message="tns:getXMLStringResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> -<wsdl:binding name="TestServiceSoapBinding" type="tns:ITestService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> -<wsdl:operation name="getXMLString"> <soap:operation style="document" soapAction=""/> -<wsdl:input name="getXMLString"> <soap:body use="literal"/> </wsdl:input> -<wsdl:output name="getXMLStringResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> -<wsdl:service name="TestService"> -<wsdl:port name="TestServiceImplPort" binding="tns:TestServiceSoapBinding"> <soap:address location="http://localhost:8081/test/test/TestSOAP"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
film911 2012-11-18
  • 打赏
  • 举报
回复
补充一下,由于看似是服务端什么版本错我一类的,mule生成的wsdl的xml信息贴一下:


<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://soap.test.jit.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" targetNamespace="http://soap.test.jit.com/" name="TestService"> -<wsdl:types> -<xs:schema xmlns:tns="http://soap.test.jit.com/" targetNamespace="http://soap.test.jit.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="unqualified"> <xs:element name="getXMLString" type="tns:getXMLString"/> <xs:element name="getXMLStringResponse" type="tns:getXMLStringResponse"/> -<xs:complexType name="getXMLString"> -<xs:sequence> <xs:element name="xml" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> -<xs:complexType name="getXMLStringResponse"> -<xs:sequence> <xs:element name="returnxml" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> -<wsdl:message name="getXMLStringResponse"> <wsdl:part name="parameters" element="tns:getXMLStringResponse"> </wsdl:part> </wsdl:message> -<wsdl:message name="getXMLString"> <wsdl:part name="parameters" element="tns:getXMLString"> </wsdl:part> </wsdl:message> -<wsdl:portType name="ITestService"> -<wsdl:operation name="getXMLString"> <wsdl:input name="getXMLString" message="tns:getXMLString"> </wsdl:input> <wsdl:output name="getXMLStringResponse" message="tns:getXMLStringResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> -<wsdl:binding name="TestServiceSoapBinding" type="tns:ITestService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> -<wsdl:operation name="getXMLString"> <soap:operation style="document" soapAction=""/> -<wsdl:input name="getXMLString"> <soap:body use="literal"/> </wsdl:input> -<wsdl:output name="getXMLStringResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> -<wsdl:service name="TestService"> -<wsdl:port name="TestServiceImplPort" binding="tns:TestServiceSoapBinding"> <soap:address location="http://localhost:8081/test/test/TestSOAP"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

8,909

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧