[WebService] the namespace on the "definitions" element, is not a valid SOAP version
公司对外通过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
总结下来,使用第1种方法修改,会一劳永逸。
另外补充其他知识:
在搜索过程中有个办法使用
new WebPServiceImplService().getWebPServiceImplPort()生成对象,经查后这个方法有两个多态方法,
public IWebPService getWebPServiceImplPort(WebServiceFeature... features)
public IWebPService getWebPServiceImplPort() {
个人理解下来前面的那个WebServiceFeature是用来改变相应的地址或其他的,可能是理解错误,然后对此做了一些深入的了解:
WebServiceFeature是一个abstract class,其有以下几个子类:
javax.xml.ws.RespectBindingFeature javax.xml.ws.soap.AddressingFeature javax.xml.ws.soap.MTOMFeature
搜了半天也没弄清楚这个类是用来干嘛的,有知道的朋友可能帮忙解答解答,以后有机会再深入研究。
参考:http://www.massapi.com/class/ad/AddressingFeature.html
[WebService] the namespace on the "definitions" element, is not a valid SOAP version的更多相关文章
- WebService发布与调用问题:expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {http://schemas.xmlsoap.org/wsdl/}definitions
Mailbox===AsYVzdwoY_b6uD s>>>>>>>javax.xml.ws.Service@103bf65 hs>>>> ...
- Property 'validate' does not exist on type 'Element | Element[] | Vue | Vue[]'. Property 'valid...
使用vue-cli 3.0+Element-ui时候,调用form表单校验时候出现的问题是: Property 'validate' does not exist on type 'Element | ...
- 【Java EE 学习 80 上】【WebService】
一.WebService概述 什么是WebService,顾名思义,就是基于Web的服务,它使用Http方式接收和响应外部系统的某种请求,从而实现远程调用.WebService实际上就是依据某些标准, ...
- 计算器之webservice实现
以下是本人原创,如若转载和使用请注明转载地址.本博客信息切勿用于商业,可以个人使用,若喜欢我的博客,请关注我,谢谢!博客地址 一.根据我的上一篇博客 MyEclipse构建Web Service(Xf ...
- WebService的简单介绍与入门使用
WebService是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集)标准来描述.发布.发现.协调和配置这些应用程序,用于开发分布式 ...
- Java调用WebService方法总结(1)--准备工作
WebService是一种跨编程语言.跨操作系统平台的远程调用技术,已存在很多年了,很多接口也都是通过WebService方式来发布的:本系列文章主要介绍Java调用WebService的各种方法,使 ...
- spring webservice 搭建出现的异常处理。异常: NAMESPACE_ERR: An attempt is made to create or change an object in a way whi
异常:NAMESPACE_ERR: An attempt is made to create or change an object in a way whi---- 这是我自己写客户端调用webse ...
- Java之webService知识
Java之webService知识 1 webservice基础知识 1.1 webService请求的本质 一次webService本质请求,如下所示: 1.2 wsdl文档解析 wsdl文档元素结 ...
- 用Python写WebService接口并且调用
一.用ladon框架封装Python为Webservice接口 另用soaplib实现请看: http://www.jianshu.com/p/ad3c27d2a946 功能实现的同时,希望将接 ...
随机推荐
- Javascript——Context和Scope的一些学习总结
1.1.1 摘要 在我们学习Javascript过程中,常常会遇到作用域(Scope)和执行上下文(Context)等概念.其中,执行上下文与this关键字的关系密切. 有面向对象编程经验的各位,对于 ...
- C# nullable<T> 用法小结
今天在园子里看到一个关于C#中对于可空类型的描述的帖子,感觉不错于是自己写了个小例子尝试下. 在C#中,对于可空类型描述为:Nullable<T>, 它表示该类型是可以为空的一个类型.它被 ...
- SQL Server数据库主键与索引的几点区别
我们在使用SQL Server数据库的时候常常会创建主键和索引,那么主键和索引到底有什么样的不同呢?本文我们主要介绍了主键和索引的区别. 主键和索引的区别如下: 主键是索引,但索引不一定是主键. 主键 ...
- Nginx如何设置拒绝或允许指定ip访问
location ~ /druid/ { #deny 192.168.1.1; allow 192.168.1.1; deny all; proxy_pass http://127.0.0.1:808 ...
- Pooled Allocation池式分配实例——Keil 内存管理
最近翻看Kei安装目录,无意中发现C51\LIB下的几个.C文件: CALLOC.CFREE.CINIT_MEM.CMALLOC.CREALLOC.C 看到 MALLOC.C 和 FREE.C 想到可 ...
- Java for LeetCode 215 Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the so ...
- 【leetcode】Longest Consecutive Sequence(hard)☆
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. F ...
- 【linux】linux脚本中#!/bin/sh的含义
来源:百度知道 #! /bin/sh 是指此脚本使用,/bin/sh来解释执行,#!是特殊的表示符,其后面根的是此解释此脚本的shell的路径.
- ubunto安装pycharm
转载:http://www.cnblogs.com/zhcncn/p/4027025.html 1. 下载 http://www.jetbrains.com/pycharm/download/ 选择L ...
- JavaEE编码题
1.请编写代码实现登录效果(5分) 要求: 1)手写出相应的HTML和CSS代码 2)字体大小12px,表格宽300px,按钮行占两列并水平居中, 3)可以写在style节点内,也可使用行内CSS或者 ...