What is today the quickest way to implement this in Java? I thoughted AXIS+Tomcat. Maybe is there any other newest library?
Yes, there is a much better way. Forget Axis and go for a JAX-WS stack such as JAX-WS RI (which is included in Java 6) or Apache CXF. Here is the usual HelloWorld service with a test method using the built-in HTTP server of the JDK:
package hello;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService
public class Hello {
@WebMethod
public String sayHello(String name) {
return "Hello, " + name + ".";
}
public static void main(String[] args) {
Endpoint.publish("http://localhost:8080/WS/Hello", new Hello());
}
}
Just run the main
method and you're ready to play with the web service.
Of course, you'll want to deploy your web service on a real container for production use. You could go with GlassFish and just deploy your service (GlassFish bundles a JAX-WS runtime). Or you could pick Jetty or Tomcat and install the chosen runtime on it (JAX-WS RI or Apache CXF). Refer to their respective instructions.
Resources
Related question