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 ,就可以生成代理代码.
随机推荐
- 小tip: base64:URL背景图片与web页面性能优化
转自:http://www.zhangxinxu.com/wordpress/?p=2341 一.base64百科 Base64是网络上最常见的用于传输8Bit字节代码的编码方式之一,可用于在HTTP ...
- PHP计算字符串长度函数
//计算字符串长度 function strlen_utf8($str) { $i = 0; $count = 0; $len = strlen ($str); while ($i < $len ...
- vue-router 重定向
1.从 /a 重定向到 /b const router = new VueRouter({ routes: [ { path: '/a', redirect: '/b' } ] }) 重定向的目标也可 ...
- JavaScript AJAX原生写法
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...
- 远程链接mysql数据库
mysql -P3306 -uroot -proot 显示最大连接数 show variables like '%max_connections%'; 设置最大链接数 ;//默认100--只对当前进程 ...
- Android开发之Serializable 和 Parcelable的差别(源码分享)
android 中自己定义的对象序列化的问题有两个选择一个是Parcelable,另外一个是Serializable. 一 序列化原因: 1.永久性保存对象.保存对象的字节序列到本地文件里. 2.通过 ...
- (三)Thymeleaf标准表达式之——文字(literals)
2.2 文字(literals) 模板名称:text.html 2.2.1 文本(text literals)(放在 单引号 里面,可以是任意字符) <p> Now you are loo ...
- day14—JQuery编程基础
JQuery 1.什么是jQuery jQuery是一个优秀的JavaScript框架.一个轻量级的JavaScript类库.jQuery的核心理念是Write less.Do more. 使用jQu ...
- tomcat启动之后报404
启动之后什么异常都没有,但是就报404,很伤,为此和女朋友分了手. 如果项目以前还是可以正常运行的话,不妨试下下面这个办法: 停止tomcat,把tomcat下面的项目删除掉,之后右键单击项目,run ...
- Heterogeneity Wins
 Heterogeneity Wins Edward Garson THE nATuRAl EvoluTion oF CoMpuTER TECHnology has brought about im ...