2 Replies Latest reply on Dec 10, 2009 10:57 AM by nicokiki

    inject seam component into WebService implement class

    renliangfeng
      Hi All,

      Does anyone know about how to inject a seam component into WebService implement class? My WebService implement class is as follows:

      @Name("importService")
      @WebService(name="ImportService", serviceName="ImportService")
      public class ImportService
      {
              @In(create=true)
              PersonHome personHome;

              @WebMethod
              public String importData(Person person)
              {
                      personHome.setInstance(person);
                      personHome.persist();
                     
                      super.persist(person);
                      return "SUCCESS";
              }
      }

      Here personHome is a component in seam scope, however it is always null. Can anyone tell me what's wrong with this or is there a better solution for this?

      Thanks
      Bruce
        • 1. Re: inject seam component into WebService implement class
          hurzeler

          The question is actually how to deploy that webservice in a war rather than an ear.


          It seems that the standard-jaxws-endpoint-config.xml that sits in WEB-INF/classes/META-INF gets ignored I believe.


          The webservice that Liangfeng proposes is not actually a statless bean and I don't believe it has to be. I think the problem is that Seam does not wrap it.


          In the web.xml file Liangfeng has:


               <servlet>
                    <servlet-name>ImportService</servlet-name>
                    <servlet-class>com.something.ws.ImportService</servlet-class>
               </servlet>
               <servlet-mapping>
                    <servlet-name>ImportService</servlet-name>
                    <url-pattern>/importservice/*</url-pattern>
               </servlet-mapping>
          



          I also believe that is not necessary. However if that is not in the web.xml file the webservice gets ignored altogether.


          The technology stack: JBoss-4.2.3, Seam-2.1.2CR2, JBossWS-3.0.1


          Please help!




           

          • 2. Re: inject seam component into WebService implement class
            nicokiki

            Hi,
            I'm struggling with this same issue and I'm trying to get in touch with all the people that faced the same problem.


            Were you able to use Pojo based webservices in Seam?


            Regards,


            Nico