Use myeclipse10 to develop a JAX-WS-based Web service instance within 5 minutes

Source: Internet
Author: User

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:

 

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.