In one of my interview,interviewer asked me what is the diference between servlet and RESTful webservice.
I said webservice internally uses servlet.
Then he asked why do i need to go for webservlet instead of sevlet.
I said webservice return xml.so webservice can interact with other application like Dot Net,perl.
He said he can do the same in servlet.
I'm unanswerable to this question.
can any one please explain me what is the advantage of webservice over servlet.
The main difference between a servlet and web services is, we will expose web services through the wsdl (web service description language) . so you can give wsdl to as many users of different platforms an languages.
Wsdl describes the service, what are the operations it does and where is it located. where as servlet cannot.