What is Web Service? How it is Tested?
A web service in simple terminology can be defined as a service offered by an application installed on a particular device or server to another device or client application after communicating with each other through WWW (World Wide Web).
It generally uses HTTP or HTTPS protocol over the application layer of the computer network where one application transfer data or send requests as XML or JSON and receives the response which is processed by the client application as a service irrespective of the underlying software platform, architecture, and technology.
For example, an application written in .NET platform wants to access the data in the form of API from an application in the JAVA platform, this is possible through the transfer of XML request and response between the applications.
Let’s understand how this is helpful in our day to day life in a simpler manner.
Suppose we have a broker application and want to display stock information for indexes. My application needs not to collect the data and carve the graph of indexes, instead, I may use the web service from any third party application keeping the live information about indexes and process the information on my website.
Here I need to care about the host architecture and platform, just need to send the XML request using HTTP/HTTPS/ protocol over www and process the XML response to display desired stocks indexes on my website.
This resolves the complexities of developing and maintaining complex programs in one’s application which is simplified with the use of web services as plug and play operation from third party vendors which are maintaining such program as web service.
Web Service identified
- Any service which is available on the internet or intranet or virtual private network (VPN).
- A service that uses standard XML message format.
- A service that is platform-independent as well as not restricted to the particular operating system or programming language.
- A service that can be discovered by a simple find mechanism over the World Wide Web which is a URL.
- A service that self-describe through common XML grammar.
- A service capable of exchanging information via HTTP or HTTPS protocol over the World Wide Web.
Components
The basic web services platform is XML message format and HTTP request and response. All the standard web services work using the following components
- SOAP (Simple Object Access Protocol)
- UDDI (Universal Description, Discovery, and Integration)
- WSDL (Web Services Description Language)
A web service enables communication among various applications installed on different devices by using open standards as discussed below:
- HTML page to send the request and render the received the response via HTTP/HTTPS protocol.
- XML to tag the request and response data.
- SOAP to transfer a message over the web.
- WSDL to describe the availability of web service.
Web services Example
Consider a banking web service that registers the user and generates a unique user id and password to access their account on their website. Suppose a user registers himself online for the first time after opening an account with the bank.
Check Also: V Model
The banking web service is a JAVA program that resides on the Solaris machine that interacts with the database for processing the data received from the JSP application which registers the users online through the World Wide Web.
Below are the steps which will be performed by this operation:
- The client program running as JSP application bundles the user details like his name, phone number, email id, address, and bank account number received offline into a SOAP message.
- This SOAP message is sent to the web service via the HTTP POST request over the World Wide Web.
- The Web service unpacks the SOAP message, parse the XML message and generate command-line commands that process the request and interacts with the database.
- The server-side program embedded in Web service after database lookup validates the data and if the information is correct then creates the unique UID and Password and bundles this data into another SOAP message as a response.
- This response is sent back to the client JSP application as a SOAP message using an HTTP POST response.
- A SOAP message is unpacked, validated, and parsed by the client program.
- If validation of the SOAP message is successful, the client JSP program processes the SOAP message data. Client program renders the information such as“UID and password successfully created” on the web browser screen and sent this actual information (UID and password) through an email or as an SMS on the phone which the user had registered with the bank.
- If validation of SOAP message fails then web service will send the error information in the SOAP message which will be rendered on the web browser screen like “Input data does not match the details requested, UID and Password not created”.This is how the web service operation of generating UID and Password for a banking application gets completed. Below is the pictorial representation
Web services testing involves:
- WSDL file definition understanding.
- Operations provided by the Web Service.
- XML Request message format that sent a SOAP request message.
- XML Response message format received as SOPA response message.
- A simple local tool or test program that could send XML message request and receive the request as XML message response.
Leave a Reply