zoukankan      html  css  js  c++  java
  • 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文件时。不要改动目录的名称。



         

  • 相关阅读:
    OSG-提示“error reading file e:1.jpg file not handled”
    OSG-加载地球文件报0x00000005错误,提示error reading file simple.earth file not handled
    QT-找开工程后,最上方提示the code model could not parse an included file, which might lead to incorrect code completion and highlighting, for example.
    我的书《Unity3D动作游戏开发实战》出版了
    java中无符号类型的第三方库jOOU
    Windows批处理备份mysql数据
    使用 DevTools 时,通用Mapper经常会出现 class x.x.A cannot be cast to x.x.A
    Java版本,Java版本MongoDB驱动,驱动与MongoDB数据库,Spring之间的兼容性
    Jrebel本地激活方法
    wget下载指定网站目录下的所有内容
  • 原文地址:https://www.cnblogs.com/jzssuanfa/p/6761324.html
Copyright © 2011-2022 走看看