Use eclipse to create WebService step by step

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.