File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Difference between Web Services and Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Difference between Web Services and Servlets" Watch "Difference between Web Services and Servlets" New topic

Difference between Web Services and Servlets

Abhishek Mulay

Joined: Sep 19, 2010
Posts: 1

Can anybody explain me what is the difference between Web-Services and Servlets ? Is the web service alternative to the Servlets ? Really confused....

Thank you,
pankaj rana

Joined: May 04, 2007
Posts: 1

Web Service defines higher level abstraction such as some business specific functionality and can be defined using PHP, Java, C# or any other language. While Servlet is just a software implementation component responsible for transport of data. A servlet is an HTTP query handler. You can do what you want with your incoming queries
You access servlet via HTTP while you access Web Service via SOAP (Simple Object Access Protocol).
web services are used to provide API to other applications, the WSDL file of your web service can give the caller enough information to invoke your web service 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 .
I agree. Here's the link:
subject: Difference between Web Services and Servlets
jQuery in Action, 3rd edition