Wsdl2java Simple to use

Source: Internet
Author: User

First, use the tool Wsdl2java to convert the interface to a locally callable. java file

Directory Structure of the tool:

          

Set parameters in Wsdl2java (URL). bat

Set axis_lib=. \libset java_cmd=java-djava.ext.dirs=%axis_lib%set Output_path=. \sourceset package = SMS%java_cmd% org.apache.axis.wsdl.wsdl2java-o%output_path%-p%package% http://123 . 123.123.123:8080/ Xxxservice/services?wsdl
Set output_path=. \source//path of the target Java output
Set package= SMS//directory name containing Java source files
HTTP://123.123.123.123:8080/XXXSERVICE/SERVICES?WSDL//webservice is located in the address, generally outside the network, so the tool must be run smoothly.

After setting the parameters, the bytes run Wsdl2java (URL) in the network unblocked environment. bat script, and then get 4 Java files like, different WebService names may not be the same.

Four files approximate contents:
① a file is an interface file that defines the API
② The connection information file, the file usually ends with locator.
③ encapsulates the file that implements the interface, the file usually ends with a stub, and is the file where the class we are instantiating is located.
④ Other related documents

General methods of Use:
① 4 related files into a Java project.
② Importing related jar packages

③ Call the microwave service in the main function or somewhere else
 Public classTestWebService { Public Static voidMain (string[] args)throwsexception{Try{String XML= "<dataxml>\n"; Perforwardinfoimplservicelocator Locator=Newperforwardinfoimplservicelocator ();//Get Connection object Java.net.URL URL=NewJava.net.URL (Locator.getperforwardinfoimplportaddress ()); Get WebService address perforwardinfoimplservicesoapbindingstub PSS=Newperforwardinfoimplservicesoapbindingstub (Url,locator); Instantiates an object pss.productmemberimmediatetest (XML);        Call the Websrvice method System.out.println (XML); }Catch(Exception e) {e.printstacktrace (); }    }}

Note: This does not fully explain the principle, it is simply used. Ownership of the relevant software is owned by the author.

Wsdl2java and the jar packages to be used in the project:

http://download.csdn.net/detail/zhangaocommit/9093091

  

Wsdl2java Simple to use

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.