To answer your question, ask first what is a web service?
A web service is a way of communication between two electronic devices on the World Wide Web. (Wikipedia)
Now the accepted industry standard for two devices for communication over the Internet uses XML messages (which makes it interoperable )
This leads us to various types of web services, mostly divided into SOAP and RESTful.
- SOAP web services use XML (which corresponds to a specific protocol or xml scheme, which, in other words, is called WSDL ). Thus, SOAP web services establish specific rules / rules regarding the exchange of messages between web services and their clients. Messages can be exchanged using any convenient protocol except HTTP.
- Now, in a RESTful script, you still exchange messages (xml / json, etc.), but there are no new additional specifications (I know WADL , but came up with more to provide support for RESTful tools and has nothing to do with RESTful web services)
- RESTful does not have a new protocol definition (for messaging). It uses the already established HTTP protocol standards, which pass parameters to the URL as path elements and HTTP methods for sending data (namely GET / POST / PUT / DELETE).
Now for your question about whether servlets are insecure web services, let's see what Servlets do.
- Accept GET / POST request
- Returns HTML (well, generally) (which is essentially XML)
Now, if the servlet is written in such a way that it can be called with the following URL
http: //www.myrestwebservices/services/getstockquote/GOOG
This servlet
So technically speaking, yes, a servlet is RESTful web services, but this may not be enough for a typical business requirement for web services as such. Therefore, for full-blown RESTful web services, we need a servlet (nonetheless) written specifically to meet these basic business requirements.
source share