1 Reply Latest reply on Sep 30, 2014 7:03 AM by Martin Kouba

    SEAM RESTeasy web service on JBoss 6.1 final

    Roger Lee Apprentice

      I have had to re-visit an existing live application and add a web service. It uses jboss-seam-2.2.2.Final and JBoss 6.1.0 Final.

       

      I played around with RESTeasy web services on JBoss 7 a while  ago and got a simple test as below working (see result at end), However I can't seem to get the same code working on JBoss AS 6.1.

       

      I have the WebService bean:-

       

      @Stateless

      @Name("smokeSignalsResource")

      @Path("/smokeSignalsService")

      public class SmokeSignalsResource {

       

          @EJB

          private PlayListBean playListBean;

        

          /**

           * Retrieves representation of an instance of smokeSignalsService.SmokeSignalsResource

           * @return an instance of java.lang.String

           * @throws UnknownHostException

           */

          @GET

          @Produces("text/html")

          public String getXml() throws UnknownHostException {

          System.out.println("SmokeSignalsResource getXml playListBean = " + playListBean);

       

              return "<html><body><h2>" + playListBean.getPlayList() + "!</h2></body></html>";

          }

       

          /**

           * PUT method for updating an instance of SmokeSignalsResource

           * @param content representation for the resource

           */

          @PUT

          @Consumes("text/plain")

          public void putXml(String content) {

          playListBean.setPlayList(content);

          }

      }

       

      The PlayListBean just returns a string of the IP address with the date and time.

       

      I also have the class:-

       

      import javax.ws.rs.core.Application;

      @javax.ws.rs.ApplicationPath("resources")

      public class ApplicationConfig extends Application {

      }

       

      I access the webservice with:-

      <IP address>/<Context><"resources"><path>

      I also tried:

      <IP address>/<Context><"resources"><path><name>

       

      http://localhost:8080/SmokeSignals/resources/smokeSignalsService/

       

      Which returns:-

       

      HTTP Status 404 - /SmokeSignals/resources/smokeSignalsService


      type Status report

      message /SmokeSignals/resources/smokeSignalsService

      description The requested resource (/SmokeSignals/resources/smokeSignalsService) is not available.


      JBoss Web/3.0.0-CR2


      Though I don't the have successfully deployed code, it's as above (changed  path from viViFYdService to  smokeSignalsService). I found the EAR on a server and when I started JBoss AS 7.1.1 and entered:

      http://mydomain.com/resources/viViFYdService

      ViViFYdResource playListBean @ id8331/109.108.138.78: 2014/09/30 10:26:56!

       

      Which is what I expect. Any issues with JBoss 6.1 and SEAM's RESTeasy?

       

      Thanks.