8 Replies Latest reply on Jul 24, 2006 2:14 AM by basel

    Seam web services (RESTful ones)?

    robjellinghaus

      Are there any recommended best practices for constructing web services based on Seam? It would be very nice to get a sample REST-like web services app... right now the only path into Seam seems to be through JSF.

      It looks like you could write a sort of XML-based web service with Facelets, but I don't think it's exactly best practice... or is it? Anyway, are there any examples of using Seam without JSF per se, or is that not the best way to think about constructing REST-y web services with Seam?

      For instance, if I wanted to build something like the Flickr REST API http://www.flickr.com/services/api/response.rest.html with Seam, should I do it via Facelets for now?

      In an adjacent thread, Gavin says his priorities are AJAX + JSF and CRUD app generation. (I don't understand the app-generation focus, but maybe I'm just not worried enough by Rails ;-) Is anyone building Seam-based web services in the meantime?

      Cheers!
      Rob

        • 1. Re: Seam web services (RESTful ones)?
          robjellinghaus

          Hm, my bad, this has been discussed already:

          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=83603

          So either wait for JAX-WS (which is not what I want for something cheap and RESTy like the Flickr API), or just roll my own servlet with filter around Seam. I'll probably go down the latter route once I get there.

          Cheers!
          Rob

          • 2. Re: Seam web services (RESTful ones)?
            gavin.king

            I have been doing a LOT of thinking about restful webservices with Seam, and I'm actually pretty happy with facelets as a way to produce XML (I already implemented an RSS feed in the blog example). JSF as the request processing layer is also OK, I guess, but it feels kinda wierd to use JSF this way (you aren't using any of the JSF lifecycle).

            • 3. Re: Seam web services (RESTful ones)?
              gavin.king

              Note that Seam-WS and Seam-REST are two entirely seperate things....

              • 4. Re: Seam web services (RESTful ones)?
                robjellinghaus

                 

                "gavin.king@jboss.com" wrote:
                I'm actually pretty happy with facelets as a way to produce XML (I already implemented an RSS feed in the blog example).

                Ah cool, I missed that. Will check it out. Not sure how it works to do POSTs with XML in them to a JSF app, but that's probably just my inner newbie talking... doesn't seem like it should be a problem.
                JSF as the request processing layer is also OK, I guess, but it feels kinda wierd to use JSF this way (you aren't using any of the JSF lifecycle).

                That seems like a feature, not a bug :-) If you don't care about big chunks of the lifecycle, stub it right out!

                • 5. Re: Seam web services (RESTful ones)?
                  gavin.king

                   

                  Ah cool, I missed that. Will check it out. Not sure how it works to do POSTs with XML in them to a JSF app, but that's probably just my inner newbie talking... doesn't seem like it should be a problem.


                  This is the thing that I have spent the most time thinking through. The biggest problem with building RESTful webservices is parsing incoming XML, and I think that calls for a whole new API for XML parsing.

                  Though I note that Flikr just seems to use plain old request parameters in its API, no XML....


                  That seems like a feature, not a bug :-) If you don't care about big chunks of the lifecycle, stub it right out!


                  Wellyes, it is automatically stubbed out by JSF (non-faces request).

                  • 6. Re: Seam web services (RESTful ones)?
                    basel

                     

                    "gavin.king@jboss.com" wrote:
                    (I already implemented an RSS feed in the blog example)

                    Does SeamListener handle the request to index.rss and parse the EL elements?

                    • 7. Re: Seam web services (RESTful ones)?
                      gavin.king

                      I don't understand what you are asking. The code is in CVS if you want to take a look.

                      • 8. Re: Seam web services (RESTful ones)?
                        basel

                        Sorry for not being clear.
                        After taking a closer look at web.xml I noticed that the FacesServlet handles all the requests to /seam/. So this applies to index.rss as well, please correct me if I am wrong.
                        I got confused becuase in my current setup I have *.jsf mapped to the FacesServlet. So I started to wonder about how Seam handles request to index.rss.