The simplest Web Service implementation, webservice implementation

Source: Internet
Author: User

The simplest Web Service implementation, webservice implementation
Overview

Here we provide a simple Web Service implementation based on JAX-WS. Except for jdk, no other jar packages are required. Web Services ExplorerAccess the service. Server implementation
package cn.ljl.sand.jws.chapter0.service;import javax.jws.WebService;import javax.xml.ws.Endpoint;@WebServicepublic class HelloService {    public String hello(String name) {        return "Hello," + name;    }        public static void main(String[] args) {        String address = "http://localhost:6666/service/hello";        Endpoint.publish(address, new HelloService());    }}

The class has two points worth noting:

Access through Eclipse tools Eclipse is embedded Web Services ExplorerTool, which can be used as a client to access the services released above. 1. Set a web browser in Eclipse Web Services ExplorerYou need to open it in a browser. You can use an Eclipse embedded browser or another external browser. I used Google Chrome here. Later I found that I could not see the SOAP message and switched to IE. 2. Open the tool Run-Launch the Web Services assumer3. request the wsdl address of the service, which is the address we released on the server. ?wsdl.



From Weizhi note (Wiz)



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.