cxf wsdl2java 命令

来源:互联网 发布:淘宝游戏交易平台 编辑:程序博客网 时间:2024/06/05 01:20

使用cxf 自带的wsdl2java 工具进行webservice 的客户端程序生成


前提是服务器端webservice 已经发布

下载 apeache-cxf-xxxx 

在电脑环境设置中增加 CXF_HOME=apeache-cxf-xxxx 所在位置

path 中增加  %CXF_HOME%/bin;

在dos 环境下 输入 wsdl2java ,如果报出命令方法,则设置成功


例如 http://localhost:8080/springcxf/GreetingService?wsdl 可以在浏览器里看到xml内容

例如  wsdl2java -p 指定生成文件命名空间    -d   程序生成的地方    -client 服务器发布的wsdl服务

  实例    wsdl2java -p  com.wsdl    -d d:/wsdl     -client http://localhost:8080/springcxf/GreetingService?wsdl

则在 d:/wsdl 下生成文件


前提是服务器端webservice 已经发布

生成的文件放入工作空间,发现报错
 //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
    //compliant code instead.
    public SayHelloImplService(WebServiceFeature ... features) {
        super(WSDL_LOCATION, SERVICE, features);
    }


    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
    //compliant code instead.
    public SayHelloImplService(URL wsdlLocation, WebServiceFeature ... features) {
        super(wsdlLocation, SERVICE, features);
    }


    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
    //compliant code instead.
    public SayHelloImplService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
        super(wsdlLocation, serviceName, features);
    }

三个super()报错

在网上找到原因是因为jax-ws2.2规约与java6冲突
删去这几个构造函数即可

0 0