Java WSDL automatically generates WebService client

Source: Internet
Author: User

Call the WebService interface in a Web project and create your own WebService server

Because the server is not in the external network, the encoding environment is not directly accessible to the other side of the WebService interface, so you need to download the WSDL file locally, in the tool generated proxy class.

Use Java's JDK to bring command wsimport-s. XXX.WSDL Build proxy class

    • Where-s means that the source code is generated, and if not specified, only the. CALSS bytecode file is generated.
    • The middle point "." Represents the current path
    • The following spaces are connected to the local WSDL file or URL, for example http://www.xxx.com/serviceInterface?wsdl

The Wsimport command can specify the package name and generate the jar package, etc., the specific command usage Baidu

But this time the execution command was unsuccessful, error: Use ofSOAP Encoding was not supported

Baidu a bit, said is Wsimport not support use= "encoded", is the older format, need to use axis this framework

One blog has a workaround: Generate client based on WSDL: use of SOAP Encoding are not supported

But I used eclipse to automatically generate the client proxy class based on WSDL, without having to import the jar package and then invoke the command.

    • This is the Java EE Eclipse, which integrates the axis plugin, and MyEclipse doesn't seem to be working.

The steps are as follows:

1. First create a Java project and copy the WSDL file into the

2. Project right-click to create a Web service client

3. Select the WSDL file and click Finish

4. Complete

Since I am using the IntelliJ Idea Development project, I also need to copy the proxy class and configure MAVEN to import the relevant jar packages for axis

    • You can modify the package name in Eclipse First, it will automatically associate the modification, or you can copy it to IntelliJ and modify it.

    • Configuring the required jar packages in Pom.xml
  • Mail-1.4.jar
  • Saaj-api-1.3.jar
  • Jaxrpc-1.1.jar
  • Commons-discovery-0.2.jar
  • Commons-logging-1.1.jar
  • Axis-1.4.jar
  • Activation-1.1.jar
  • Wsdl4j-1.4.jar

Here are some configurations, other go to Maven repository search, and then copy and paste them.

Service-side release is using CXF framework, just use TINYMCE blog is not very accustomed to, the next article on the service side bar

About axis and CXF framework differences, citing other people's blogs: WebService axis and cxf of the pop frame

Java WSDL automatically generates WebService client

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.