Eclipse + Java SE 6 quick Web Service creation

Source: Internet
Author: User
Tags java se
From https://www6.software.ibm.com/developerworks/cn/education/webservices/ws-eclipse-javase1/section2.html

1. New Java Project

Make sure JRE is Java SE 6

2. Create pojo

 
Package COM. myfirst. wsserver; import javax. JWS. webService; @ webservicepublic class sayhello {Private Static final string salutation = "hello"; Public String getgreeting (string name) {return salutation + "" + name ;}}

3. Use wsgen to generate intermediate files

Wsgen-CP./bin-keep-S./src-D./bin com. myfirst. wsserver. sayhello

4. Web Service publish

Package COM. myfirst. wsserver; import javax. XML. WS. endpoint; public class runservice {/*** @ Param ARGs */public static void main (string [] ARGs) {system. out. println ("sayhello Web Service started. "); endpoint. publish ("http: // localhost: 8080/wsserverexample", new sayhello ());}}

5. Run as Java applicaiton startup Service

6. http: // localhost: 8080/wsserverexample? View the content of a wsdl file in WSDL

7. Eclipse provides run> launch the Web Services explorer to test the web service. You can use the WSDL file.

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.