import javax.jws.WebService;
@WebService
public class HelloWorld {
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<endpoint
name="HelloWorld"
implementation="com.example.HelloWorld"
url-pattern="/hello" />
</endpoints>
public class HelloWorldClient {
public static void main(String[] args) {
HelloWorldService service = new HelloWorldService();
HelloWorld port = service.getHelloWorldPort();
String response = port.sayHello("John");
System.out.println(response);
}
}