Web services can be defined by many ways:
Web services is a client application or application component for communication
Web services is a software system for interoperable machine to machine communication
A web service is a collection of standards or protocols for exchanging information between two devices or application.
For example: java, .net, PHP application can communicate with other application through web services over the network. So web service is a language independent way of communication.
Types of Web Services:
There are two types of web services:
- SOAP services.
- REST services.
SOAP is a protocol which was designed before the REST. Soap Stands for Simple Object Access Protocol that has been around for a while and enjoys all the benefits of long term use. Microsoft developed SOAP to take place of older technologies that don’t work well on the internet.
The main idea behind designing SOAP was to ensure that program built in different platform and programming language could exchange data in easy manner. It is a XML based protocol for accessing web services.
The XML is used to make requests and receive responses in SOAP can become extremely complex. In some languages, you need to build those requests manually. This becomes a problem because SOAP is intolerant of errors. In Fact when working with .Net languages, you never even see the XML.
Rest web server is an Architecture style not a protocol. It is an abbreviation of Representational State Transfer. This was designed especially for working with component such as media component, file or even objection on a particular hardware device.
Any web service that is defined on the principles of REST can be called as Restful web service. REST provides a lighter weight alternative. Instead of using XML to make a request, REST relies on simple URL in many cases. In some situations you must provide additional information in special ways, but most web services using REST.
A RestFul web service relies exclusively on obtaining the needed information using the URL approach. REST can use four different HTTP1.1 verbs (GET, POST, PUT and DELETE) to perform tasks.
DIFFERENCE BETWEEN SOAP AND REST WEB SERVICES
SOAP WEB SERVICE
REST WEB SERVER
1. SOAP is a protocol
1. REST is a Architecture style
2. It is an abbreviation of Simple Object Access protocol
2. It is an abbreviation of Representational State Transfer
3. SOAP was designed with a Specification. It includes a WSDL file which has the required information on what the web services does in addition to the location of the web service
3. REST is an architecture style in which a web service can only be treated as RESTFul service
4. SOAP cannot make use of REST since SOAP is a protocol and RESR is architecture.
4. REST can make use of SOAP as the Underlying protocol for web services, because in the end it is just an architecture patter.
5. SOAP defines standards to be strictly followed.
5. REST does not defines too much Standards like SOAP.
6. SOAP requires more bandwidth and resources
6. REST requires less bandwidth and resources.
7. SOAP defines its own security.
7. RESTFul web services inherit security measurements from the underlying transport.
8. SOAP is less preferred than REST.
8. REST is more preferred than SOAP.