原文链接:http://damonshell.sinaapp.com/?p=81
今天在调用接口时,报了个错误,意思为两个类调用了同一个XML TYPE;
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions Two classes have the same XML type name "{http://ws.check4AChannel.channel.asiainfo.com/}createCCMappingResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.boco.iam.module_bj.application.utils.webservice.channel.check4achannel.ws.jaxws_asm.CreateCCMappingResponse this problem is related to the following location: at com.boco.iam.module_bj.application.utils.webservice.channel.check4achannel.ws.CreateCCMappingResponse at public javax.xml.bind.JAXBElement com.boco.iam.module_bj.application.utils.webservice.channel.check4achannel.ws.ObjectFactory.createCreateCCMappingResponse(com.boco.iam.module_bj.application.utils.webservice.channel.check4achannel.ws.CreateCCMappingResponse) at com.boco.iam.module_bj.application.utils.webservice.channel.check4achannel.ws.ObjectFactory Two classes have the same XML type name "{http://ws.check4AChannel.channel.asiainfo.com/}check4AChannel". Use @XmlType.name and @XmlType.namespace to assign different names to them.
经过一番查询,觉得是服务端在生成WSDL时,将相应类的命名空间都默认为同一个了,因此网上才有了修改命名空间的建议;即在相应类(即客户端调用的java实体类)中加入@XmlType
(namespace=”http://namespace.thats.not.the.same.as.the.generated”),即改变响应类的命名空间。
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "createCCMapping", propOrder = { "channelCode", "channelType", "crmCode", "doneType" },namespace="http://namespace.thats.not.the.same.as.the.generated") public class CreateCCMapping { }
另外,还有一种修改相应类的名称,若如此修改,可能会影响服务端调用,建议修改命名空间。
相关推荐
cxf生成客户端 服务端代码
cxf生成webservice客户端代码
webservice客户端,框架为CXF,生成客户端的方式为自动(myeclipse生成)
cxf生成webservice客户端
使用cxf wsdl2java生成webservice客户端命令
cxf客户端调用axis服务端流程
使用cxf生成onvif协议的客户端。使用onvif协议提供的wsdl文件生成客户端。
CXF客户端生成器,可以直接进入bin目下,运行wsdl2java
带详细解决方案说明文档,提供三种解决方式,另外包含stax2-api.jar,stax2-api-source.jar,woodstox-core-asl-4.4.1.jar,stax-ex.jar,wstx-asl-3.2.9.jar等jar文件,亲测有效。
用CXF作为客户端调用webService的demo:本人亲测可用,eclipse工程项目包含完整代码和完整jar包, 只要用eclipse导入项目即可,运行控制台显示success或者false字符串,说明OK。
CXF 客户端最少jar包支持,CXF 客户端最少jar包支持,CXF 客户端最少jar包支持,
使用CXF生成动态调用webservice接口的客户端,也比较简单。
1.使用Java 2.用cxf开发webservice ...客户端也需要接口类文件和pojo,和cxf客户端xml 但是没有接口的实现类,就是为了去服务端来调用的。 具体有不懂可以问我 给我发消息, 劳烦评价 ,请大家支持原创 禁止转载
cxf java代码生成 wsdl文件 ,wsdl文件生成 java代码,相关博文: http://blog.csdn.net/dream_broken/article/details/35331949
cxf在创建客户端出现编码GBK-不可映射字符的编码问题解决的jar
cxf 开发webservice客户端 代码经过测试
webservice的cxf框架客户端调用所需jar包,不要删除里面的jar包,直接放在lib下。亲测可用。
Springboot整合CXF发布Web service和客户端调用(用户和密码验证)打开及用
费了我两天的劲才把需要最少的jar包给搞明白了,共享出来需要的可以试试!