import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface MyWebService {
@WebMethod
String sayHello(String name);
}
@WebService(endpointInterface = "com.example.MyWebService")
public class MyWebServiceImpl implements MyWebService {
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
import javax.xml.ws.Endpoint;
public class MyWebServicePublisher {
public static void main(String[] args) {
String url = "http://localhost:8080/myWebService";
Endpoint.publish(url, new MyWebServiceImpl());
}
}