CXF生成客户端注意事项

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

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

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

Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionExceptionat 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.ServiceConstructionExceptionat 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 moreCaused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptionsTwo classes have the same XML type name "{}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.SayGoodbythis problem is related to the following location:at test3.SayGoodbyat public javax.xml.bind.JAXBElement test3.ObjectFactory.createSayGoodby(test3.SayGoodby)at test3.ObjectFactoryTwo classes have the same XML type name "{}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.SayGoodbyResponsethis problem is related to the following location:at test3.SayGoodbyResponseat public javax.xml.bind.JAXBElement test3.ObjectFactory.createSayGoodbyResponse(test3.SayGoodbyResponse)at test3.ObjectFactoryTwo classes have the same XML type name "{}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.SayHiResponsethis problem is related to the following location:at test3.SayHiResponseat public test3.SayHiResponse test3.ObjectFactory.createSayHiResponse()at test3.ObjectFactoryTwo classes have the same XML type name "{}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.SayHithis problem is related to the following location:at test3.SayHiat public test3.SayHi test3.ObjectFactory.createSayHi()at test3.ObjectFactory

因此,,在使用wsdl2java生成客户端文件时,不要修改文件夹的名称。

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

最大的成功在于最大的付出。

CXF生成客户端注意事项

相关文章:

你感兴趣的文章:

标签云: