CXF generating a Web Service Client (translating WSDL into Java code)

Source: Internet
Author: User
Tags sca wsdl

What is CXF?

Apache cxf an open-source service framework that implements some of the key standards in JCP and Web service. CXF simplifies the flexible reuse of construction, integration, service-oriented Architecture (SOA) business components and technologies. In CXF, the service uses the WSDL standard to define and be able to access by using a variety of different message formats (or binding) and network protocols (transports) including soap, XML (via HTTP or JMS). CXF also supports multiple model such as: Jax-ws,jbi,sca and CORBA service. The CXF is designed to be flexibly deployed into a variety of containers including Spring-based,jbi,sca, Servlets, and Java EE containers.

Similarities and differences of CXF and AXIS2

The Apache CXF Web service Stack is another alternative to the Apache software Foundation, and the Axis2 stack comes from the same organization. Although they come from the same organization, Axis 2 and CXF take a completely different approach to how to configure and deliver WEB services.

The integration of CXF and spring will be much easier relative to Axis2.


Download CXF

The home address of the CXF project is:

http://cxf.apache.org/

Is:

Http://cxf.apache.org/download.html

Can download the decompression version can also download the installation version. The specific download page is as follows:

Here you can download the unzip version.

Download image address: Http://mirror.bit.edu.cn/apache/cxf/3.0.1/apache-cxf-3.0.1.zip

The directory structure after decompression is as follows:


Bin directory: Contains tools that have some bat, such as Wsdl2java.bat, which translates the WSDL into Java code.

There are some jar packages in the Lib directory that are used by CXF to import these jar packages in the project in the actual development

The other catalogs don't need to be introduced more.


to generate the client code using CXF

If you now have a WSDL service address: http://xxxx/xx?wsdl

In command-line mode, enter:

Wsdl2java.bat-p com.oscar999-client-encoding utf-8-noaddressbinding http://xxxx/xx?wsdl

You can generate the code.

Description

1. Note the command-line mode switches to the directory where the Wsdl2java.bat is located (if not, write. BAT's full path)

2.-P is later configured with the package name of the code


The resulting Java file with a long class name ending in _client is called the test file, which contains the main method.




If you are testing in eclipse, you can create a new Java project, copy all the jars under Cxf Lib into the project's Lib path, and put it into the build path.

The resulting Java files are then copied into SRC to invoke the test.



CXF generating a Web Service Client (translating WSDL into Java code)

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.