Developing simple Java Web Service under eclipse
Service part
Create a new dynamic web project under eclipse
Create a new service class in the project
Write code for the sayhello class
Test: right click any blank space
perhaps
After running, the main method in the class will be called
If the following configurations appear in the running results, the publishing is successful
Visit the web page: http://localhost:9091/Service/SayHello?wsdl
Note: '? WSDL 'must be added.
The following page appears to indicate successful publishing
Client part
New client class
Of course, you can also create a new web project to write client code. This time, the client service can be placed under the same project
In the bin folder of the JDK, there is a wsimport Exe, this tool generates corresponding class files according to WSDL files. With these class files, you can call the methods provided by WebService like calling local classes. The tool can be used for non Java servers, such as web services written in c# and generating java client implementations through wsimport.
For other command parameters, please refer to: http://download-llnw.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html
Code the client class
Run as a Java application program and output the results