It is very convenient to create a WebService application using eclipse. The steps are as follows:
1. Install the WebService plug-in. Www.eclipse.org has been downloaded on the website, I download is wtp-all-in-one-sdk-R-1.5.4-win32, which includes.
2. Install a web server. Tomcat is used here.
3. Create a WebService. Create a dynamic web project in eclipse. New-> Project-> dynamic web project. After creation, write a service class, such:
Public class logonservice {
Public int checkuserright (string userid, string password ){
// Assume that you perform database operations
If (password! = NULL & "Fred". Equals (userid )){
Return 1;
}
Return 0;
}
}
Public int checkuserright (string userid, string password) is the remote method to be called.
4. Right-click the file name of the class and choose "Web Services"> "Create web service". The following interface is displayed:
Select testclient to create a service test project.
5. click Next,
Select a method name,
6. Click "Next" and click "start server" to start Tomcat and deploy the project.
7. If you click "launch", the WebService test interface you just created is displayed and can be tested.
8. At this time, the interface for creating a test proxy class will appear, and the proxy class will be created in the automatically generated test project, that is, the logonwebservicetest project.
9. Click "Next". The agent class is automatically generated and the test method selection interface is displayed. You can select the corresponding method, so eclipse will generate the corresponding page.
10. Click "finish". A page is automatically started.
Click the corresponding method on the left to perform the test.