Web Services – Definition, Working, Types, Applications
Web Service is the set of rules or guidelines which enable communication among different applications via the World wide web (.i.e. the internet). Before web service, there were other technologies but some of them have dependencies such as EJB (enterprise java bean) which allows applications to communicate only if the applications are working on Java, these dependencies make communication difficult. These dependencies are removed by web services.
In the present world, applications are developed on a variety of programming languages such as Java, Python, PHP, etc. These heterogeneous applications need communication to happen between them. Since they are developed in different programming languages it becomes difficult to ensure efficient communication between them. Here is where web services come into the picture, web services provide a language-independent way of communication that means the applications working on Java can communicate with other applications working on Python. Therefore, web service helps us to invoke the functionality of other programs in the existing program.
Why application needs to communicate
While working, some applications might need to use the service or functionality offered by other applications. To use that service or functionality applications need to communicate with each other. Let us consider an example of a restaurant, when you visit the restaurant and ask for the food(a service) then the waiter will be taking the order to the kitchen and serve you prepared food from the kitchen. Here the waiter is like the web service which allows you(.i.e. client) to communicate with the kitchen(.i.e. application).
The figure below shows another example of how the ICICI bank ATM used the service provided by SBI bank to access the database of the customer which cannot be accessed by the ICICI bank ATM directly.
How do web services work?
Web services use the request-response method to communicate among applications. For any communication, we need a medium and a common format that can be understood by everyone, in the case of web services medium is the internet and the common format is the XML (Extensible Markup Language) format as every programming language can understand the XML markup language.
A client is the one that requests some service from the server that is known as the service provider. The request is sent through a message which is in common XML format and in response to that request, the service provider will respond with a message in a common format (.i.e. XML).
Web Service Components
1. SOAP: As mentioned above SOAP stands for Simple Object Access Protocol. It is the protocol stating how the communication between the application is going to happen.
2. WSDL: It stands for Web Services Description Language which is the XML document containing the rules for communication among different software. It defines that:
- How that service can be accessed by the system requesting for it from other systems
- What is the name of the service
- What are the specific parameter needed for accessing that service, what would be the return type
- What are the error messages that would be displayed in case of any issue while accessing the data.
3. UDDI: Universal Description, Discovery, and Integration is the full form for the UDDI. It is a directory that provides us the detail that which software needs to be contacted for the particular type of data.
Types of web services
There are mainly two types of web services:
1. SOAP web services: SOAP stands for Simple Object Access Protocol. These protocols are based on XML which is a lightweight data exchange language. These protocols are independent of language and can be run on any platform.
SOAP supports both stateful and stateless operations. Stateful means that the server keeps track of the information received from the client on each request. While Stateless means that each request contains enough information about the state of the client and thus server does not need to bother about saving the state of the client thus increasing the speed of communication.
Many companies such as IBM, Microsoft are producing an implementation of SOAP into their systems.
2. RESTful web services: It stands for Representational State Transfer. They are also language and platform-independent and are faster in comparison to SOAP. Nowadays RESTful web services are more used than SOAP. They treat the data as resources. RESTful web services return data in JSON format or XML format. These web services create the object and send the state of the object in response to the client’s requests, that’s why known as Representational State Transfer.
Characteristics of web services
Following are the characteristics of web services:
- Web services are XML-based as they use XML as a standard language for data exchange as XML allows flexible coding and decoding of data with every programming language and operating system.
- Web services are coarse-grained. It means they have broader functionality and scope of operations. It is cheaper and provides more fine-grained services in one coarse-grained service.
- Web Services supports RPCs (Remote Procedure Calls). Web services that use the RPCs style are synchronous, which means the client has to wait for the response after the request. RPCs allows a program to invoke procedure and functions on remote objects.
- Web services allow loose coupling with the systems that means systems are weekly associated with each other. Web service does not concern with the state of the system involved in the process of communication.
- Web Services are Synchronous and Asynchronous. In synchronous web services, the client will wait for the response until the server sends the response. Synchronous web service is provided through RPC communication. In Asynchronous web services, the client will not wait for the response and in the meantime, it can continue with other operations processing.
Please Login to comment...