1. Using JDK Wsimport.exe to generate client code
Open the cmd Command box and enter the following format command:
Format: wsimport-s "src directory"-P "generate class with package name"-keep "WSDL publishing Address"
Example: Wsimport-s g:\\workspace\\webservice\\theclient\\src-p com.hyan.client-keep http://localhost:9001/Service/ servicehello?wsdl
Attention:
1) "src directory" address cannot contain spaces
2) "WSDL publishing address" Don't miss "? wsdl"
You can also switch the current directory to the SRC directory, and then omit the-s setting
2. Automatically generate client code using MyEclipse
To create a new Java project, select the Web service client (under MyEclipse), as shown below:
Next step
Here you select the project where the WebService client code resides
There are two ways to import WSDL, generally choose the WSDL URL, directly enter the link address on it, but if there is a problem with the online WSDL file, need to modify and then use, this time needs to be saved to the local, after the modification is completed, select the WSDL File;java Package selects the packages in which the code is located, and next verifies that no problem is available after finish.
Other methods of production can be consulted: http://blog.csdn.net/gaogaoshan/article/details/8980775