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