aspose file tools*
The moose likes Web Services and the fly likes Differences between Servlet and Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Differences between Servlet and Web Service" Watch "Differences between Servlet and Web Service" New topic
Author

Differences between Servlet and Web Service

Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Good Day,

We have here an internal conversation about the subject. Therefore, what are the benefits of using Web Services and in particular Restlets instead of Servlets?

Regards,
Dan

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

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I am considering standardized web services, such as JAX-WS and JAX-RS:
As far as I am concerned, some important advantages with standardized solutions are:
- They have been tested.
- They are probably taking more things into consideration than I am able to do if designing a custom solution.
- They are documented.
- There are other people using these solutions that you can ask and share experiences with.
- They are often portable; there are several JAX-WS implementations etc.
Best wishes!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41884
    
  63
Web services operate on a higher level than servlets, thus making it easier to implement advanced functionality. But note that almost all widely used WS implementations (Axis, CXF, JAX-WS RI, JAX-RS RI, Restlet) are implemented as web apps using the servlet API, so whatever you can do with those you can do with servlets directly - it's just way more work to implement.

I don't really agree with Ivan's list as a differentiator between "standard" WS APIs (like JAX-WS and JAX-RS) and other WS implementations (like Restlet, Axis and CXF). Those points apply to all frameworks I mentioned above to a large degree, not just the reference implementations.


Ping & DNS - my free Android networking tools app
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Thank you Ivan and Ulf.

Regards,
Dan
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Ulf Dittmer wrote:I don't really agree with Ivan's list as a differentiator between "standard" WS APIs (like JAX-WS and JAX-RS) and other WS implementations (like Restlet, Axis and CXF). Those points apply to all frameworks I mentioned above to a large degree, not just the reference implementations.

What I meant was that I only wanted to consider standardized solutions versus homebrewed solutions. The realm of other solutions may encompass things that I know little, or nothing, about - thus my reluctance to say anything about it.
Best wishes!
Samuel Behrman
Ranch Hand

Joined: Oct 02, 2009
Posts: 49
Hi.
The most obvious difference between Servlet and Web Service is:
You access servlet via HTTP while access Web Service via SOAP (Simple Object
Access Protocol).
But, in fact, you can not directly invoke a servlet, you can only open URL
connection and put some parameter to the servlet if the caller is out of
your application. And you can not restrict what parameters the caller can
put. The caller does not know what parameters your servlet can receive
either.
So, You'd better use web service to provide API to other applications, the
WSDL file of your web service can give the caller enough information to
invoke your web service.
I suggest you can learn more about web service.
Regards,
behrman.


RAQ Report: Web-based Excel-like Java reporting tool.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Differences between Servlet and Web Service