import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface CustomService {
@WebMethod
String sayHello(String name);
}
import javax.jws.WebService;
@WebService(endpointInterface = "com.example.CustomService")
public class CustomServiceImpl implements CustomService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
import javax.xml.ws.Endpoint;
public class CustomWebService {
public static void main(String[] args) {
Endpoint.publish(url, new CustomServiceImpl());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<endpoint name="CustomServiceEndpoint" implementation="com.example.CustomServiceImpl"
url-pattern="/custom-service" />
</endpoints>