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注意事项的更多相关文章

  1. 关于cxf生成客户端代码中的JAXBElement<String>

    1.使用自动生成的java文件中的 ObjectFactory构造入参 关于cxf生成客户端代码中的JAXBElement<String>    在使用cxf或者x-fire进行webse ...

  2. (转)wsdl文件用SoapUI快速创建WebService,CXF生成客户端代码

    原文地址:http://blog.csdn.net/fjekin/article/details/62234861 一.前言 最近项目接触到2C的很多接口,提供接口文档和WSDL文件,一开始测试接口都 ...

  3. WebService -- Java 实现之 CXF ( 使用CXF工具生成client 程序)

    1. 下载CXF 工具解压到磁盘 2.添加工具bin目录到PATH环境变量 3.创建一个CXF client新项目 4. run -> cmd 到指定目录,并运行工具目录下的批处理 “wadl2 ...

  4. 通过wsdl生成client 的几种方式

    wsimport 位置 %JAVA_HOME%/bin/wsimport.exe 帮助 wsimport -help Usage: wsimport [options] <WSDL_URI> ...

  5. 用cxf生成webservice的java客户端代码

    百度来的: 最近,由于要用到某公司提供的webservice实现的api接口,想到了用cxf的wsdl2java工具来生成客户端程序.(自己写是比较麻烦且费时,so偷懒一下..) 使用步骤如下: 一. ...

  6. 利用CXF生成webservice客户端代码

    一.CXF环境的配置 1.下载CXF的zip包. 2.解压.例如:D:\ITSoft\webserviceClientUtils\cxf\apache-cxf-2.7.17 3.配置环境变量:新建变量 ...

  7. CXF生成调用webservice的客户端

    首先当前是从官网下载cxf组件. http://cxf.apache.org/download.html 下载后解压,在这里主要是用到解压后的bin目录中的wsdl2java.bat该批处理文件. 可 ...

  8. 根据werservice代码用CXF生成WSDL

    原文:http://hongyegu.iteye.com/blog/619147,谢谢! import org.apache.cxf.tools.java2ws.JavaToWS; import ne ...

  9. WCF 无法生成 client

    在MVC中调用WCF 总是没有client 后来在网上查找原因,去掉Reuse type in referrenced assenbiles ,就可以生成代理代码.

随机推荐

  1. [Algorithms] Refactor a Linear Search into a Binary Search with JavaScript

    Binary search is an algorithm that accepts a sorted list and returns a search element from the list. ...

  2. Matlab中特征向量间距离矩阵的并行mex程序

    在matlab中, 有n个向量(m维)的矩阵Mat(n, m) 要计算任两个向量间的距离, 即距离矩阵, 可使用以下的并行算法以加速: #include <iostream> #inclu ...

  3. include file与jsp:include 的区别

    <%include   file="a.jsp"%>静态包含,先加入再编译,就是在编译的时候将a.jsp的代码加入进来在编译,只会生成一个servlet文件,而且不同a ...

  4. web前端性能优化汇总

    一.概述 web前端性能优化主要点为:减少HTTP请求,减小请求文件大小.其他优化. 二.优化细节 1.减少HTTP请求 (1)使用缓存 (2)雪碧图 (3)合并文件 (4)将javascript和c ...

  5. Odoo many2many command

    CREATE = lambda values: (0, False, values) // (0,False, Values) //创建 UPDATE = lambda id, values: (1, ...

  6. 【Android开发-6】了解内情,我们须要一些调试和測试手段

    前言:人生不可能十全十美,总会有些遗憾存在,经历过遗憾,我们才懂的什么是生活. 程序也一样.追求完美,就必定会有经历bug存在的时候. 经历过不断的bug磨练.我们技术才会不断的成长.对于调试bug, ...

  7. UINavigationController改变动画效果

    @interface UINavigationController (CustomTransition) - (void) pushWithCustomAnimation:(UIViewControl ...

  8. Effective JavaScript Item 10 避免使用with

    本系列作为Effective JavaScript的读书笔记. Item 9:避免使用withkeyword 重点: 设计withkeyword本来是为了让代码变简洁,可是却起到了相反的效果.比方: ...

  9. javascript 温故而知新 getBoundingClientRect

    getBoundingClientRect获取元素位置  getBoundingClientRect用于获得页面中某个元素的左,上,右和下分别相对浏览器视窗的位置. getBoundingClient ...

  10. MySQL一:初识数据库

    阅读目录 一 数据库是什么 二 数据库的概念 三 MySQL介绍 四 下载安装 五 MySQL软件基本管理 一 数据库是什么 之前所学,数据要永久保存,比如用户注册的用户信息,都是保存于文件中,而文件 ...