import javax.jws.WebService;
@WebService
public class HelloWorld {
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;
public class HelloWorldClient {
public static void main(String[] args) throws Exception {
URL url = new URL("http://localhost:8080/HelloWorld?wsdl");
QName qname = new QName("http://example.com/", "HelloWorldImplService");
Service service = Service.create(url, qname);
HelloWorld helloWorld = service.getPort(HelloWorld.class);
System.out.println(helloWorld.sayHello("Alice"));
}
}