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文件时。不要改动目录的名称。

     

时间: 2024-10-15 22:56:14

CXF生成client注意事项的相关文章

CXF生成客户端注意事项

1. 在使用wsdl2java命令生成客户端文件时在Service的Java文件里面出现super构造错误,这是由于jax-ws2.2规约与java6冲突  故需要降低jax-ws规约版本. 解决方法:wsdl2java -frontend jaxws21  http://localhost:8080/MyWebService?WSDL    生成客户端文件    2.  在使用wsdl2java生成的客户端文件  ,如果我们修改了包的名称就会出现       Exception in thre

CXF 生成Web Service Client(将WSDl 转化成 Java代码)

CXF 是什么? Apache CXF一个开源的Service框架,它实现了JCP与Web Service中一些重要标准.CXF简化了构造,集成,面 向服务架构(SOA)业务组件与技术的灵活复用.在CXF中,Service使用WSDL标准定义并能够使用各种不同的消息 格式(或binding)和网络协议(transports)包括SOAP.XML(通过HTTP或JMS)进行访问.CXF同样支持多种model 如:JAX-WS,JBI,SCA和CORBA service.CXF设计成可灵活部署到各种

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 -- Java 实现之 CXF ( 使用CXF工具生成client 程序)

1. 下载CXF 工具解压到磁盘 2.添加工具bin目录到PATH环境变量 3.创建一个CXF client新项目 4. run -> cmd 到指定目录,并运行工具目录下的批处理 “wadl2java.bat” 5. 完成后,在IDE中刷新项目,就会发现新生成的包+文件 6. 编写client类,访问webserivce package com.example.tuo.myCXFWebService.WS_Client; import com.example.tuo.webservice.He

spring整合CXF之client

前面已经创建好了服务类,并且发布了服务,现在要去调用发布放服务: 在这里我将其分成两个项目: 1.重新创建一个WebProject ,并且使用wsdl2java 这个工具生成了客户端的代码(得先配置CXF的环境): 在这里小弟我遇到了一个揪心的问题,首先我使用的是JDK1.8,然后在doc中生成代码的时候会出现这样的提示 ‘由于 accessExternalSchema 属性设置的限制而不允许 'file' 访问,因此无法读取方案文档 'xjc.xsd'. 然后我将其替换成1.7的JDK, 然而

CXF生成本地ws调用代码测试webservice

package com.free.webservice.client; import java.util.List; import cn.com.webxml.*; public class WeatherWSClient { public static void main(String[] args) { /** * 利用cxf来调用客户端 */ WeatherWS ws = new WeatherWS(); // WeatherWS port = ws.getPort(WeatherWS.c

根据werservice代码用CXF生成WSDL

原文:http://hongyegu.iteye.com/blog/619147,谢谢! import org.apache.cxf.tools.java2ws.JavaToWS; import net.bwda.service.Busi.webservice.FileMarkService; public class Java2WSDL { private Class<?> className; public String[] args1,args2,args3; /** * 构造函数 *

WCF 无法生成 client

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

EF生成实体模型注意事项

最新所做项目用的是EF框架,EF生成实体很方便,但对于初学者来说总是会遇到一些问题,在对实体进行增删改的时候,偶尔会出现这个错误, 该异常原因就是因为GRADE表没有主键导致的.EF生成实体模型时,必须保证数据库的表已经设置了主键,否则在进行增删改的过程中会抛异常.如果表没有设置主键,则生成的实体模型中会默认将表中所有不能为空的字段都定义为主键,如下图所示: