2 Replies Latest reply on Nov 14, 2007 1:00 PM by Pete Muir

    POJO webservices on tomcat

    Siarhei Dudzin Apprentice

      With POJO web services support in Seam 2.0 do I understand correctly from the reference that JBoss webservices are used?

      The actual question here is whether POJO Webservices can run on a lightweight container like Tomcat? If so what is used for webservices then (I can't find an Seam example with pojo webservice).

        • 1. Re: POJO webservices on tomcat

          Fortunately for you, I actually just finished spending quite a few hours researching how to run JAX-WS POJO web services in Tomcat, with success :).

          First off, JBossWS 2.0 doesn't support Tomcat (though it *may* work); only 1.x does. It also seems to require web services to be bundled separately from the main application WAR (AFAIK). Because of those things, JBossWS was out of the running for me.

          The only webservice framework I was able to find that supported production-quality webservices in the main WAR was Apache CXF 2.0. So far, it seems to work very nicely, though it doesn't integrate with Seam conversations (Seam only has a handler for JBossWS for that currently, though one for CXF could likely be easily created).

          I probably should write a tutorial in the Wiki for setting CXF up, but in the meantime here's how I got a basic HelloWorld up and running in my Seam app:

          pom.xml (if you use Maven):

           <!-- A large (2+mb) dependency that doesn't appear to be needed -->

          package com.demo.webservice;
          import javax.jws.*;
          import javax.jws.soap.SOAPBinding;
          import javax.jws.soap.SOAPBinding.*;
          public interface HelloWorld{
           String sayHi(@WebParam(name="addressee") String text);

          package com.demo.webservice;
          import javax.jws.WebService;
          @WebService(endpointInterface = "com.demo.webservice.HelloWorld",
           serviceName = "HelloWorld")
          public class HelloWorldImpl implements HelloWorld{
           public String sayHi(String text) {
           return "Hello " + text;

          cxf-servlet.xml (in WEB-INF):
          <beans xmlns="http://www.springframework.org/schema/beans"
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
          http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

          Added into your web.xml:

          That's it! Just open your browser to http://host:port/context/services/, and it should give a link to the webservice's WSDL file.

          • 2. Re: POJO webservices on tomcat
            Pete Muir Master

            Yes a wiki page or blog article with this on what be great, thanks Matthew!