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 ,就可以生成代理代码. 
随机推荐
- [CSS3]移动Web开发系列之CSS3增强型选择器
			css3是移动Web开发的主要技术之中的一个.当前.CSS3技术最适合在移动Web开发中使用的特性有增强的选择器.阴影.强大的背景设置 .圆角边框 接下来我们主要解说增强型的选择器.主要分两种,属性选 ... 
- 在windows上一键编译各种版本的protobuf(2017-12-05修改)
			所需工具 : cmake for windows 和 git for windows 原理:protobuf 是google的一个开源项目,其源代码在github上可以下载到,并且源码都采用cm ... 
- C++11之function模板和bind函数适配器
			在C++98中,可以使用函数指针,调用函数,可以参考之前的一篇文章:类的成员函数指针和mem_fun适配器的用法. 简单的函数调用 对于函数: void foo(const string &a ... 
- BaseAdapter的使用(笔记)
			适配器模式的应用: 1.减少程序耦合性 2.easy扩展 BaseAdapter ListView的显示与缓存机制:须要才显示,显示完就被会受到缓存. BaseAdapter基本结构 --public ... 
- 使用 JavaScript开发的跨平台音乐、书籍播放器
			代码地址如下:http://www.demodashi.com/demo/12542.html 演示效果 歌曲推荐界面 歌手搜索界面 歌词预览界面 书籍推荐界面 代码实现过程 首页代码: 'use s ... 
- Jenkins安装火线fireline插件
			原文请访问:http://magic.360.cn/zh/user.html 提示:如果您是第一次使用Jenkins,请先前往文章[Jenkins下载安装配置教程] 1. 点击左上角的`Jenkins ... 
- 约瑟夫环用php实现
			百度百科的解释:约瑟夫环(约瑟夫问题)是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围.从编号为k的人开始报数,数到m的那个人出列:他的下一个人又从1开始报数,数 ... 
- SSH框架整合时,如果某一个action提交请求时数据校验失败,后续请求全部失败
			© 版权声明:本文为博主原创文章,转载请注明出处 1.问题描述 SSH框架搭建好进行验证时发现,执行某个请求时,若参数校验失败,修改参数符合要求后再次请求依然失败.该请求一直报错如下: No resu ... 
- ueditor的上传存储问题
			1.使用了 http://download.csdn.net/download/ouyhong123/8520689 下载的修改版jar包.主要修改是增加了一个地址属性,ActionEnter的参数. ... 
- 好员工去哪儿了:高端IT白领荒胜过春节保姆荒
			来自:http://tech.163.com/14/0312/07/9N4BLV8S000915BD.html 于是,你看到的就是这样一幕悖论:一群手握大把工作机会的雇主,在面对一群眼巴巴等待工作机会 ... 
