views:

69

answers:

3

I have a large system written in a mixture of C++, Java, Python. I have to interface a very small subset of this system with a web portal using webservice technology. Webservice is not critical and it has to expose 3 or 4 methods.

What is today the quickest way to implement this in Java? I thoughted AXIS+Tomcat. Maybe is there any other newest library?

A: 

Apache Axis2, Apache CXF or Glassfish Metro 2.0 are all pretty up to date and will provide what you need. Spring-WS is probably easier to use than the previous 3, but only if you're already building in the Spring framework. For comparison see:

Miklos
+5  A: 

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

Pascal Thivent
+1  A: 

there is also project "Jersey" the JSR-311 (JAX-RS) reference implementation. A Framework for Web Services implementing the REST principles, which in my opinion modern Web Services should adhere to. It got lots of tutorials on the web to be found.

smeg4brains