Webservices like REST, SOAP which provides services which is made available for web application, as we know it can receives values as JSON, string, XML etc either by POST or GET and in the same way it can return data as JSON, string, XML etc.

The same thing can be done via servlet, as servlet can receive data as string, JSON etc either by POST or GET and in the same way it can return data as JSON, string, XML etc.

We need libraries based upon the web service we use, such as SOAP or REST, servlet libraries are almost in-built int it.

So whats the difference between Servlet and Web Services? Which one is more faster?

Can anyone please tell me some solution for this.