This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RESTful Architecture vs. servlet Framework

 
Ulli Hertlein
Greenhorn
Posts: 15
Oracle VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
     
    Ulli Hertlein
    Greenhorn
    Posts: 15
    Oracle VI Editor Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Rancher
    Pie
    Posts: 42967
    73
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 13056
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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!)
     
    Ivan Krizsan
    Ranch Hand
    Posts: 2198
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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!
     
    Dan Drillich
    Ranch Hand
    Posts: 1183
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Rob Heittman once spoke to it in the context of Restlets at Differences between Servlet and Restlet.

    Regards,
    Dan

     
    Leon Omk
    Ranch Hand
    Posts: 75
    Chrome Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ivan Krizsan wrote:Hi!
    Using JAX-RS annotations, it becomes, in my opinion, much more clear.


    Agree
     
    amit punekar
    Ranch Hand
    Posts: 544
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic