What is Web Services?
Web services are the types of internet software that uses standardized messaging protocol over the distributed environment. It integrates the web-based application using the REST, SOAP, WSDL, and UDDI over the network. For example, Java web service can communicate with .Net application.
Features of web Services
- Web services are designed for application to application interaction.
- It should be interoperable.
- It should allow communication over the network.
Components of Web Services
The web services must be able to fulfill the following conditions:
- The web service must be accessible over the internet.
- The web service is discoverable through a common mechanism like UDDI.
- It must be interoperable over any programming language or Operating System.
Uses of Web Services
- Web services are used for reusing the code and connecting the existing program.
- Web services can be used to link data between two different platforms.
- It provides interoperability between disparate applications.
How does data exchange between applications?
Suppose, we have an Application A which create a request to access the web services. The web services offer a list of services. The web service process the request and sends the response to the Application A. The input to a web service is called a request, and the output from a web service is called response. The web services can be called from different platforms.
There are two popular formats for request and response XML and JSON.
XML Format: XML is the popular form as request and response in web services. Consider the following XML code:
The code shows that user has requested to access the DataStrutureCourse. The other data exchange format is JSON. JSON is supported by wide variety of platform.
JSON Format: JSON is a readable format for structuring data. It is used for transiting data between server and web application.
To make a web service platform-independent, we make the request and response platform-independent.
Now a question arises, how does the Application A know the format of Request and Response?
The answer to this question is “Service Definition.” Every web service offers a service definition. Service definition specifies the following:
- Request/ Response format: Defines the request format made by consumer and response format made by web service.
- Request Structure: Defines the structure of the request made by the application.
- Response Structure: Defines the structure of response returned by the web service.
- Endpoint: Defines where the services are available.