CXF WebService generate client code and invoke service side problems

Source: Internet
Author: User
Tags wsdl

1, Download CXF development tool Apache-cxf-3.1.4.zip from the Internet ,

Unzip the file and locate the Apache-cxf-3.1.4\bin directory containing a Wsdl2java file

2. Setting Environment variables

1, cxf_home=f\cxf\apache-cxf-3.1.4.

2, add%cxf_home%/bin after path;

3. Add%cxf_home%/lib after classpath;

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

3. Generate client code with DOS commands

Wsdl2java Related commands:

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.

The Generate Code command is: (generated based on the obtained WSDL file)


wsdl2java-autonameresolution-frontend jaxws21-impl-exsh true-p com.bocom.webservice.client-d G:\shengcheng G:\s HENGCHENG\WEATHER.WSDL

Where-P is followed by the designation of the generated code, and-D is the location of the disk where the code is generated and where the WSDL file is stored

When the code was generated, the JDK version was jdk1.8.0_131, and the CXF version that began 由于 accessExternalSchema 属性设置的限制而不允许 ‘file‘ 访问, 因此无法读取方案文档 ‘xjc.xsd‘ to be used was the apache-cxf-2.7.6 "", error, Baidu took the next solution, Said to be in the JDK directory under Jre\lib add a property file Jaxp.properties, and write the following content Javax.xml.accessExternalSchema = All, I tried the problem is not resolved, and then replaced The apache-cxf-3.1.4 build succeeds. Also note that Java uses CXF to invoke the WebService minimum jar package, avoiding the problem of conflicts between jar packages.

CXF WebService generate client code and invoke service side problems

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.