Introduction to Web Services
In this tutorial, we will find the answer to the question – What is a web service? We will learn the basics of web services, their features, and the two types of web services.
After this tutorial, we will move forward to tutorials on manual testing and automation testing of these web services in our subsequent tutorials.
What is a Web Service?
A Web service is a web application that can communicate with other web-based applications over a network. Web services implementation allows two web applications developed in different languages to interact with each other using a standardized medium like XML, SOAP, HTTP etc.
Features of Web Services
- Web services are based on open standards like XML, HTTP. So these are operating system independent.
- Likewise, web services are programming language independent. A Java application can consume a PHP web service.
- Web services can be published over the internet to be consumed by other web applications.
- The consumer or the client of the web-service is loosely coupled with the web service. So the web services can update or change its underlying logic without affecting the consumer.
Types of Web Services
SOAP Web Service
SOAP stands for Simple Object Access Protocol. It is a standardized protocol for message exchange between web applications. The message format supported by SOAP is XML. A web service that is based on SOAP protocol is called SOAP web service.
RESTful Web services or REST API
REST stands for Representational State Transfer. It is an architectural style that describes some constraints for web service development. The web services satisfying these constraints are RESTful web services. The six REST architecture constraints are-
- Client-Server – Client and server are separated by a uniform interface. These are not concerned with each other’s internal logic.
- Stateless – Each client request is independent and contains all the necessary information required to get executed. No client data is saved at the server.
- Cacheable – The client should have the ability to cache the responses.
- Layered System – A layered system having multiple layers wherein each layer communicates with the adjacent layer only.
- Uniform Interface – A uniform interface design requires each component within the service to share a single and uniform architecture.
RESTful APIs implements the following types of HTTP methods-
- GET – HTTP GET method retrieves some information.
- POST – HTTP POST method submits and creates new resources.
- PUT – HTTP PUT updates an already existing resource.
- DELETE – HTTP DELETE deletes a resource.
Check an amazing video on Rest APIs, explained by Navin Reddy “Telusko”
In this tutorial, we studied web services and their type. In the next post, we will see the difference between a SOAP and RESTful web services.