CXF生成client注意事项
1. 在使用wsdl2java命令生成client文件时在Service的Java文件中面出现super构造错误,这是因为jax-ws2.2规约与java6冲突 故须要减少jax-ws规约版本号。
解决方法:wsdl2java -frontend jaxws21 http://localhost:8080/MyWebService?
WSDL 生成client文件
2. 在使用wsdl2java生成的client文件 。假设我们改动了包的名称就会出现
Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:347)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:336)
at javax.xml.ws.Service.getPort(Service.java:92)
at test3.MyWebService.getWebServiceTestImplPort(MyWebService.java:58)
at test3.Test.main(Test.java:12)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:446)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:548)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:478)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:345)
... 4 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://test2/}sayGoodby". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at test3.jaxws_asm.SayGoodby
this problem is related to the following location:
at test3.SayGoodby
at public javax.xml.bind.JAXBElement test3.ObjectFactory.createSayGoodby(test3.SayGoodby)
at test3.ObjectFactory
Two classes have the same XML type name "{http://test2/}sayGoodbyResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at test3.jaxws_asm.SayGoodbyResponse
this problem is related to the following location:
at test3.SayGoodbyResponse
at public javax.xml.bind.JAXBElement test3.ObjectFactory.createSayGoodbyResponse(test3.SayGoodbyResponse)
at test3.ObjectFactory
Two classes have the same XML type name "{http://test2/}sayHiResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at test3.jaxws_asm.SayHiResponse
this problem is related to the following location:
at test3.SayHiResponse
at public test3.SayHiResponse test3.ObjectFactory.createSayHiResponse()
at test3.ObjectFactory
Two classes have the same XML type name "{http://test2/}sayHi". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at test3.jaxws_asm.SayHi
this problem is related to the following location:
at test3.SayHi
at public test3.SayHi test3.ObjectFactory.createSayHi()
at test3.ObjectFactory
因此,在使用wsdl2java生成client文件时。不要改动目录的名称。
CXF生成client注意事项的更多相关文章
- 关于cxf生成客户端代码中的JAXBElement<String>
1.使用自动生成的java文件中的 ObjectFactory构造入参 关于cxf生成客户端代码中的JAXBElement<String> 在使用cxf或者x-fire进行webse ...
- (转)wsdl文件用SoapUI快速创建WebService,CXF生成客户端代码
原文地址:http://blog.csdn.net/fjekin/article/details/62234861 一.前言 最近项目接触到2C的很多接口,提供接口文档和WSDL文件,一开始测试接口都 ...
- WebService -- Java 实现之 CXF ( 使用CXF工具生成client 程序)
1. 下载CXF 工具解压到磁盘 2.添加工具bin目录到PATH环境变量 3.创建一个CXF client新项目 4. run -> cmd 到指定目录,并运行工具目录下的批处理 “wadl2 ...
- 通过wsdl生成client 的几种方式
wsimport 位置 %JAVA_HOME%/bin/wsimport.exe 帮助 wsimport -help Usage: wsimport [options] <WSDL_URI> ...
- 用cxf生成webservice的java客户端代码
百度来的: 最近,由于要用到某公司提供的webservice实现的api接口,想到了用cxf的wsdl2java工具来生成客户端程序.(自己写是比较麻烦且费时,so偷懒一下..) 使用步骤如下: 一. ...
- 利用CXF生成webservice客户端代码
一.CXF环境的配置 1.下载CXF的zip包. 2.解压.例如:D:\ITSoft\webserviceClientUtils\cxf\apache-cxf-2.7.17 3.配置环境变量:新建变量 ...
- CXF生成调用webservice的客户端
首先当前是从官网下载cxf组件. http://cxf.apache.org/download.html 下载后解压,在这里主要是用到解压后的bin目录中的wsdl2java.bat该批处理文件. 可 ...
- 根据werservice代码用CXF生成WSDL
原文:http://hongyegu.iteye.com/blog/619147,谢谢! import org.apache.cxf.tools.java2ws.JavaToWS; import ne ...
- WCF 无法生成 client
在MVC中调用WCF 总是没有client 后来在网上查找原因,去掉Reuse type in referrenced assenbiles ,就可以生成代理代码.
随机推荐
- 【Excle】在重复数据中对日期排序并查询最新的一条记录
现在存在以下数据: 需要查询出以下数据 姓名 日期 张三 2017-12-14 李四 2017-12-16 在E1中写入以下公式:=IF(D2=MAX(IF($C$ ...
- Dalvik opcodes 查询smali语法大全
原文链接:http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html Vx values in the table denote a Dalvik ...
- brew Error: Formulae found in multiple taps
Mac PHP brew install php56-apcu Error: Formulae found in multiple taps: * homebrew/php/php56-apcu * ...
- Spring4整合Hibernate5时不能自动生成表结构
© 版权声明:本文为博主原创文章,转载请注明出处 1.问题描述: Spring4整合Hibernate5时,不再使用hibernate.cfg.xml,将其内容整合到Spring配置文件中,启动后不能 ...
- 【已解决】WebUploader 0.1.5 安卓手机不能访问相机、IOS直接访问相机 的问题
WebUploader 0.1.5 安卓手机不能访问相机.IOS直接访问相机 的问题 打开 webuploader.js if(navigator.userAgent.indexOf('Android ...
- AngularJS路由 $state服务、路由事件、获取路由参数
1 ui-sref.$state.go 的区别 ui-sref 一般使用在 <a>...</a>: <a ui-sref="message-list" ...
- 安卓SAX解析XML文件
XML文件经常使用的解析方式有DOM解析,SAX解析. 一.Sax SAX(simpleAPIforXML)是一种XML解析的替代方法. 相比于DOM.SAX是一种速度更快,更有效的方法. 它逐行扫描 ...
- CSS基础2——选择器
前面说过样式规则.也知道了样式规则语法形式为:选择器+声明块 如:div{ color:black:padding:10px; } div即表示选择器(此处是元素选择器),花括号里的内容就是声明块 ...
- Linux进程的虚拟内存区域划分
Linux进程的虚拟内存区域分为:代码区.只读常量区.全局区.BSS段.堆区.栈区 代码区:存储功能代码,函数名所在的区域 只读常量区:存放字符串常量,以及const修饰的全局变量 全局区/数据区:存 ...
- 关于并发模型 Actor 和 CSP
最近在看<七天七并发模型>这本书,在书上介绍了 Actor 和 CSP 这两种并发模型.这两种模型很像,但还是有一些不同的地方.看完之后,比较困扰的是: 在什么场合使用哪种模型比较好呢? ...