[WebService] the namespace on the "definitions" element, is not a valid SOAP version
2015-10-08 10:53
344 查看
原文:http://www.cnblogs.com/garinzhang/p/the_namespace_on_the_definitions_element_is_not_a_valid_SOAP_version.html?utm_source=tuicool
公司对外通过webservice访问别人接口,对方webservice IP地址发生变化,切换过去之后,始终报错,在网上搜索了各种办法之后,暂时总结该问题几种可能解决办法,待真正解决时用的到。
异常详情:
org.apache.cxf.binding.soap.SoapFault: "http://schemas.xmlsoap.org/wsdl/",
the namespace on the "definitions" element, is not a valid SOAP version.
javax.xml.ws.WebServiceException: 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.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:154)
可能的几种解决办法:
1. 在编写代码时不要使用factory.create创建service,而使用cxf生成的类创建,具体如下:
2. 在调用时设置Address时,在方法1的factory.setAddress后面设置的地址,将?wsdl去掉:
总结下来,使用第1种方法修改,会一劳永逸。
另外补充其他知识:
在搜索过程中有个办法使用
new WebPServiceImplService().getWebPServiceImplPort()生成对象,经查后这个方法有两个多态方法,
public IWebPService getWebPServiceImplPort(WebServiceFeature... features)
public IWebPService getWebPServiceImplPort() {
个人理解下来前面的那个WebServiceFeature是用来改变相应的地址或其他的,可能是理解错误,然后对此做了一些深入的了解:
WebServiceFeature是一个abstract class,其有以下几个子类:
javax.xml.ws.RespectBindingFeaturejavax.xml.ws.soap.AddressingFeaturejavax.xml.ws.soap.MTOMFeature
搜了半天也没弄清楚这个类是用来干嘛的,有知道的朋友可能帮忙解答解答,以后有机会再深入研究。
参考:http://www.massapi.com/class/ad/AddressingFeature.html
公司对外通过webservice访问别人接口,对方webservice IP地址发生变化,切换过去之后,始终报错,在网上搜索了各种办法之后,暂时总结该问题几种可能解决办法,待真正解决时用的到。
异常详情:
org.apache.cxf.binding.soap.SoapFault: "http://schemas.xmlsoap.org/wsdl/",
the namespace on the "definitions" element, is not a valid SOAP version.
javax.xml.ws.WebServiceException: 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.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:154)
可能的几种解决办法:
1. 在编写代码时不要使用factory.create创建service,而使用cxf生成的类创建,具体如下:
// 原先在代码里使用的方法 JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(IWebPService.class); String address1 = "http://192.168.0.121:9090/cloudsun/HelloWorldService?wsdl"; factory.setAddress(address1); IWebPService ws1 = (IWebPService) factory.create(); // 修改成以下方式初始化 URL url = new URL(address1); IWebPService ws1 = new (url).getWebPServiceImplPort();
参考:http://www.devexception.com/apache/31208.htm
2. 在调用时设置Address时,在方法1的factory.setAddress后面设置的地址,将?wsdl去掉:
例如:http:
//服务器IP/UA/TrustAuth?wsdl
修改为:http:
//服务器IP/UA/TrustAuth
参考:http://www.oschina.net/question/115223_37755
总结下来,使用第1种方法修改,会一劳永逸。
另外补充其他知识:
在搜索过程中有个办法使用
new WebPServiceImplService().getWebPServiceImplPort()生成对象,经查后这个方法有两个多态方法,
public IWebPService getWebPServiceImplPort(WebServiceFeature... features)
public IWebPService getWebPServiceImplPort() {
个人理解下来前面的那个WebServiceFeature是用来改变相应的地址或其他的,可能是理解错误,然后对此做了一些深入的了解:
WebServiceFeature是一个abstract class,其有以下几个子类:
javax.xml.ws.RespectBindingFeaturejavax.xml.ws.soap.AddressingFeaturejavax.xml.ws.soap.MTOMFeature
搜了半天也没弄清楚这个类是用来干嘛的,有知道的朋友可能帮忙解答解答,以后有机会再深入研究。
参考:http://www.massapi.com/class/ad/AddressingFeature.html
相关文章推荐
- 关于fseek不能定位大于2G文件的问题
- 黑马程序员---OC学习笔记之autorelease注意及错误用法
- LeetCode——Best Time to Buy and Sell Stock III
- Asp.net Web.Config - 配置元素 trace
- 2015国庆日程
- POJ 2411 Mondriaan's Dream (状压DP,骨牌覆盖,经典)
- 天气代码调用代码示例
- 计算机图形学——基于3D游戏开发技术——第一章游戏模型
- 使用VS2012自带数据库发布网站
- MySQL引擎
- su和sudo
- 计算机视觉:随机森林算法在人体识别中的应用
- 运用Autoconf和Automake生成Makefile的学习之路
- vh,可视窗口100%高
- 选择排序
- 解决centos7下tomcat启动正常,无法访问项目的问题
- jQuery初始化的几张方法
- Java值传递与引用传递
- 如何利用子视图
- Android项目中的双击退出应用