1. Open myeclipse and create a new Web service project.
Ii. Enter the project name demo
Click Finish to create a project.
3. Create a Java class
Package server;
Public class demo {
Public String sayhello (string name ){
Return name + ", hello! ";
}
}
4. Right-click SRC and choose new> Other.
5. Select Web Service under myeclipse Web Services
6. Click Next and select create Web service from Java class.
7. Click Next and select the class just entered.
8. Click Finish, release the project to Tomcat, start Tomcat, and access http: // 127.0.0.1: 8080/demo/demoport.
The result is as follows:
The Web Service is created.
9. Create a client. Open the wizard and select Web service client.
10. Click Next
11. Click Next, select the wsdl url, and enter http: // 127.0.0.1: 8080/demo/demoport? WSDL, Java package input Client
12. Click Next
13. Click Finish.
Generate client call code
14. Create a client
Package test;
Import client. demodelegate;
Import client. demoservice;
Public class test {
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
Demoservice Server = new demoservice ();
Demodelegate dd = server. getdemoport ();
String result = dd. sayhello ("Lions ");
System. Out. println (result );
}
}
15. Run Test
The following are the running results: