What is Web Service Testing? How it is Tested?

What is Web Service? How is it Tested?

In simple terminology, a web service 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 transfers data or sends 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 the .NET platform wants to access the data in the form of API from an application in the JAVA platform; this is possible through transferring XML requests and responses 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 collects the data and carves the graph of indexes. Instead, I may use the web service from any third-party application, keeping the live information about indexes and processing the information on my website.

Here, I need to care about the host architecture and platform, send the XML request using HTTP/HTTPS/ protocol over www, and process the XML response to display desired stock indexes on my website.

This resolves the complexities of developing and maintaining complex programs in one’s application, which is simplified by using web services as plug-and-play operations from third-party vendors maintaining such programs as web services.

Web Service identified

  • Any service available on the internet, intranet, or virtual private network (VPN).
  • A service that uses standard XML message format.
  • A platform-independent service and 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-describes 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 response via HTTP/HTTPS protocol.
  • XML will 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.

The banking web service is a JAVA program that resides on the Solaris machine and 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 that this operation will perform:

  • The client program running as a 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, parses the XML message, and generates command-line commands that process the request and interact with the database.
  • After database lookup, the server-side program embedded in the Web service validates the data and, if the information is correct, creates the unique UID and Password and bundles this data into another SOAP message as a response.
  • This response is returned 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 the SOAP message is validated successfully, the client JSP program processes the SOAP message data. The client program renders the information, such as“UID and password successfully created,” on the web browser screen. It sends this actual information (UID and password) through an email or as an SMS on the phone that the user had registered with the bank.
  • If the SOAP message’s validation fails, the 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.
  • The XML response message format was received as the SOPA response message.
  • A simple local tool or test program that could send an XML message request and receive the request as an XML message response.

I love open-source technologies and am very passionate about software development. I like to share my knowledge with others, especially on technology that's why I have given all the examples as simple as possible to understand for beginners. All the code posted on my blog is developed, compiled, and tested in my development environment. If you find any mistakes or bugs, Please drop an email to softwaretestingo.com@gmail.com, or You can join me on Linkedin.

Leave a Comment