File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes RESTful Architecture vs. servlet Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "RESTful Architecture vs. servlet Framework" Watch "RESTful Architecture vs. servlet Framework" New topic
Author

RESTful Architecture vs. servlet Framework

Ulli Hertlein
Greenhorn

Joined: Jan 13, 2011
Posts: 15

Hello world,

i'm just new to webservices (thanks to ivan for your study notes !!!) and have a question regarding application architecture.
e.g. an architect wants to build a resource-oriented application based on RESTful webservices (http-binding). he talks about this
approach with a collegue (which is new to jax-ws) and after some time his collegue states the opinion that its better to do the
job using a plain old servlet framework like struts, turbine or spring.

what is your opinion about this ? which are the strong advantages of the RS approach ?

thanks in advance for your answers.

ulli


Professional Senior Crap Manager & doing Livestrong
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39549
    
  27
I think there's some confusion over technologies:

  • JAX-WS is an API for SOAP-based WS, not RESTful WS


  • Struts et al. are web app frameworks - they're used for web pages, not web services


  • So if you're looking to implement a RESTful WS, check out projects like Jersey (the JAX-RS reference implementation).


    Ping & DNS - updated with new look and Ping home screen widget
    Ulli Hertlein
    Greenhorn

    Joined: Jan 13, 2011
    Posts: 15

    Ulf Dittmer wrote:I think there's some confusion over technologies:
  • JAX-WS is an API for SOAP-based WS, not RESTful WS

  • ....


    hi ulf, my understanding is that RESTful WS is fully supported in JAX-WS via Provider/Dispatcher/HTTP binding lowlevel programming.
    The following article explains this (with examples):

    http://www.oracle.com/technetwork/articles/javase/index-137171.html



    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 39549
        
      27
    Yes, but that's a kludge. Using a SOAP framework for REST WS is not the best way to go about things.

    Also note that JAX-WS may support REST, but it does not support JAX-RS - which is the standard Java API for REST WS.
    William Brogden
    Author and all-around good cowpoke
    Rancher

    Joined: Mar 22, 2000
    Posts: 12682
        
        5
    Yes, but that's a kludge. Using a SOAP framework for REST WS is not the best way to go about things.


    Agree++

    You lose all the clarity of RESTful style by trying to jam it into a SOAP framework. JAX-WS is too tightly tied to JAXB and XML in general. Remember that a RESTful approach can serve any (repeat any) resource with equal facility.

    Bill
    (repeating myself I know, but read Fielding's Dissertation!)


    Java Resources at www.wbrogden.com
    Ivan Krizsan
    Ranch Hand

    Joined: Oct 04, 2006
    Posts: 2198
        
        1
    Hi!
    I am going to repeat myself a little too.
    Of course you can use servlets etc to build services, but the interesting question is (in my opinion) what the consequences will be.
    As before, REST is an architectural style which aim is to obtain certain goals as described in the Wikipedia article: http://en.wikipedia.org/wiki/Representational_State_Transfer
    In order to obtain those goals, you have to follow certain principles (also described in the Wikipedia article).
    It is possible to follow those principles when developing servlet-based services. I can also develop Object-Oriented software using assembly language - the question is if it is a convenient and time-efficient approach.
    Also, my experience is that the more clear patterns, for instance for developing a service, there are, the more likely it is that the result created by different developers is more similar. One of the risks is that there is no clear pattern how to develop a service using servlets. Using JAX-RS annotations, it becomes, in my opinion, much more clear.
    Best wishes!


    My free books and tutorials: http://www.slideshare.net/krizsan
    Dan Drillich
    Ranch Hand

    Joined: Jul 09, 2001
    Posts: 1164
    Rob Heittman once spoke to it in the context of Restlets at Differences between Servlet and Restlet.

    Regards,
    Dan


    William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
    Leon Omk
    Ranch Hand

    Joined: Aug 17, 2010
    Posts: 75

    Ivan Krizsan wrote:Hi!
    Using JAX-RS annotations, it becomes, in my opinion, much more clear.


    Agree


    OK, so that other guy knows Java better than I do, but I bet he can't speak Wuhanese(a Chinese Dialect) like me.
    amit punekar
    Ranch Hand

    Joined: May 14, 2004
    Posts: 507
    Hello,
    I just came across this post and one article on REST. Just thought of posting it here if it clarifies some of the aspects.

    Here is the link.

    Regds,
    Amit
     
    wood burning stoves
     
    subject: RESTful Architecture vs. servlet Framework
     
    Similar Threads
    SOA Consumer scalable Architectures/Design patterns
    web pages: which technology
    How to create a webservice for existing JSP application
    RESTful webservices
    JAX-WS or JAX-RS for RESTful??