Use eclipse to create a WebService project, eclipsewebservice
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. (It seems that it is useless for me to download it. It is probably the same as the installed Eclipse)
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 (the image below) 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.
Note: Problems Encountered
Execution error: D: \ MyDrivers \ software \ apache-tomcat-7.0.50 \ bin \ tcnative-1.dll: Can't load IA 32-bit. dll on a AMD 64-bit platform
Solution: copy the tcnative-1.dll under the tomcat \ bin directory to the jdk \ bin directory
Check the Tomcat location: cmd-> cd directory-> catalina version.
Check the number of JDK bits: cmd-> java version, which is displayed as 64-bit, but not 32-bit.