CXF生成客户端注意事项

1. 在使用wsdl2java命令生成客户端文件时在Service的Java文件里面出现super构造错误,这是由于jax-ws2.2规约与java6冲突  故需要降低jax-ws规约版本。

解决方法:wsdl2java -frontend jaxws21  http://localhost:8080/MyWebService?WSDL    生成客户端文件

   2.  在使用wsdl2java生成的客户端文件  ,如果我们修改了包的名称就会出现

      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生成客户端文件时,不要修改文件夹的名称。

     

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-07 23:04:10

CXF生成客户端注意事项的相关文章

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文件  .假设我们改动了包的名称就会出现       Except

使用CXF将wsdl文件生成客户端代码命令

1.先下载cxf包 http://cxf.apache.org/download.html,现在cxf包.(下载资源就有) 2.解压缩包,通过cmd命令进入到bin目录下(cd cxf\bin的路径) cxf生成客户端代码 3.使用wsdl2java命令生成客户端代码 在命令行执行wsdl2java -p org.logink.ws -d f:\logink\src -all E:\wsdl3.1-credit\LogisticsCreditService\LogisticsCreditServ

cxf webservice生成客户端代码及调用服务端遇到的问题

1.  从网上下载cxf开发的工具 apache-cxf-3.1.4.zip, 解压文件,找到apache-cxf-3.1.4\bin目录,里面包含一个wsdl2java文件 2. 设置环境变量 1.CXF_HOME=F\CXF\apache-cxf-3.1.4. 2.在path后面加上 %CXF_HOME%/bin; 3.再classpath后面加上%CXF_HOME%/lib; 在cmd命令中输入wsdl2java,如果有提示usage,就表明配置成功  3.利用dos命令,生成客户端代码

cxf 生成 webservice 客户端

一.cxf 生成 webservice 客户端 1.接口路径 http://localhost:8080/cxfserver/webservice/userWS?wsdl 2.进入你需要放置 webservice 客户端代码的包,进入这个包所在的系统路径,进入 cmd 3.执行命令 wsimport -keep http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl 或者 wsdl2java -client http://ws.webxml

webservice发布服务:CXF及客户端调用

2.CXF:(与spring整合) CXF相对来说操作没有AXIS繁琐 1.导入spring的jar包和cxf的jar包 2.在spring的核心配置文件中配置发布的接口类 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.o

用soapUI生成客户端代码

一.用soapUI生成客户端代码 方法一: 1.第一步,打开soapUI,菜单栏里的tools,选择apache CXF,如图, 2.第二步,WSDL:写上你连接服务端的地址,OutputDirectory:选择你生成的客户端的保存路径,package:选择你的包的名字.再点击Tools,如图所示: 3.如上图配置,在点击ok,上一步那个图,点击generate即可. 方法二: 1.选择File,点击new soapUI project,如下图所示,project Name :是你链接服务端的名

“wsimport -keep ”生成客户端报错“Use of SOAP Encoding is not supported.”

本来想用 “wsimport -keep ” 生成客户端,结果报错“Use of SOAP Encoding is not supported.” 应该是缺jar包, 闲麻烦就发现了百度经验上的 这个方法.以下是教程 wsdl文件生成客户端 首先我们需要知道webservice接口地址,这里我的测试地址为http://localhost:8085/Service/Function?wsdl.   右击另存为,保存为.wsdl的文件.   在eclipse中新建一个java项目.   将.wsdl

用内存流 文件流 资源生成客户端(Delphi开源)

正文:很多木马生成器就是用的内存流和文件流生成客户端的,废话不多说了,代码如下: unit Main; interface usesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, Inifiles; typeTForm1 = class(TForm)GroupBox1: TGroupBox;msgtitle: TEdit;GroupBox2: TGroupBo

常用的生成客户端脚本方法

常用的生成客户端脚本方法: RegisterArraryDeclaration -- 添加javascript数组     RegisterClientScriptBlock-- 在 Web 窗体的开始处(紧接着 <form runat="server"> 标识之后)    RegiserStartScript-- ------- 在</form>前添加script代码块 RegisterStartupScript-- 在 Web 窗体的结尾处    Regis