Use of the Apache CXF Wsdl2java tool

Source: Internet
Author: User
Tags wsdl

cxf Wsdl2java Commands and JDK wsimport commands are distinguished and used
The JDK provides a wsimport.exe command, primarily for generating WebService client code, and then calling WebService.
Wsimport is based on jdk1.6.0_21 and above to generate native code, it can only parse the server-side SOAP protocol is 1.1, cannot parse the SOAP1.2 protocol. If parsing SOAP1.2 will parse incomplete.
Usage: If the JDK is already configured for the PATH environment variable http://localhost:9007/Webservice/hello?wsdl

http://localhost:9007/Webservice/hello?wsdl is the path to the WSDL.
CXF also provides command Wsdl2java.exe to generate client code from WSDL. It is a native code generated from jdk1.7, so you need to make a little bit of changes to the generated code.
It can support SOAP1.1 and SOAP1.2 protocols. The prerequisite is that you have downloaded Apache CXF and configured the Wsdl2java.exe for the PATH environment variable.
usage: C:\Documents and settings\administrator> wsdl2java-d E:\workspace\CXF_client\src-p com.cxf_client.server http://localhost:9007/Webservice/hello?wsdl

http://localhost:9007/Webservice/hello?wsdl is the path to the WSDL.

Simple use of Apache CXF Wsdl2java Tools

Use the following steps:

First, download the Apache CXF package, such as Apache-cxf-2.7.10.zip, address: cxf.apache.org/download.html

Second, decompression apache-cxf-2.7.10.zip to a directory, such as D:\apache-cxf-2.7.10

Third, set environment variables

1, cxf_home=d:\apache-cxf-2.7.10

2, add%cxf_home%/bin after path;

Enter Wsdl2java in the CMD command, indicating that the configuration is successful if a prompt usage is available

Iv. Running Wsdl2java Tools

In the cmd command, enter: wsdl2java-d d:\\src-client http://api.xxx.cn/xxxAPI/service/auditResBatchQueryService?wsdl

(D:\\src is the directory where the client program code resides, HTTP://API.XXX.CN/XXXAPI/SERVICE/AUDITRESBATCHQUERYSERVICE?WSDL is the address that defines WebService)

Attached Wsdl2java usage:

Wsdl2java-p com-d D:\\src-all xx.wsdl

-p Specifies the namespace of its WSDL, which is the package name to generate code for:

-d Specifies the directory where the code is to be generated

-client generating the code for the Client test Web service

-server The build server starts the code for the Web service

-impl Generating the implementation code for a Web service

-ant Generating Build.xml files

-all generates all start endpoint codes: Types,service Proxy,,service interface, server mainline, client mainline, implementation object, and an an T build.xml file.

Use of the Apache CXF Wsdl2java tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.