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)