What Is Web Service? How It Is Tested?

To proceed with the next topic in the SoapUI tutorial series we are covering the most interesting topic called “What is Web Service Testing“. 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). Web Services generally uses HTTP or HTTPS protocol over the application layer of 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 web 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 web service 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 is maintaining such program as web service.

Web Service identified as:

What is Web Service?
What is Web Service?
  • 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 a 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.

Web Services 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)

Web services Operation:

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. 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:

  1. 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.
  2. This SOAP message is sent to the web service via the HTTP POST request over the World Wide Web.
  3. The Web service unpacks the SOAP message, parse the XML message, and generates command-line commands that process the request and interacts with the database.
  4. The server-side program embedded in Web service after the 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.
  5. This response is sent back to the client JSP application as a SOAP message using an HTTP POST response.
  6. A SOAP message is unpacked, validated, and parsed by the client program.
  7. If the validation of the SOAP message is successful, 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 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.
  8. If validation of the SOAP message fails then 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”.
  9. This is how the web service operation of generating UID and Password for a banking application gets completed. Below is the pictorial representation:
Web Service Request and Response model

Web Service Request and Response model

Web Service Testing: In the last tutorial, we discussed the SoapUI tool which is used to test web services and Web APIs. In this tutorial we are going to discuss what actually the web services testing involves:

  • WSDL file definition understanding.
  • Operations provided by the Web Service.
  • XML Request message format that sent as 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 request as XML message response.

We are going to discuss the above testing steps in detail in our next tutorial series “Web Service Sample Project and its Testing”. Most of the time in the tutorials the term Web service and Web API will be used therefore let’s understand the difference between Web Services and Web APIs as demonstrated below:

Differences between Web Services vs Web API:

PropertiesWeb ServicesWeb APIs
Data Structure for information exchangeOnly XML formatted is used as structured data for information exchange and communication.Structured data could be XML formatted, JSON formatted, or plain data.
Data and Request CompressionHTML requests can be compressed but XML data cannot be compressed.Here data can be compressed.
Defined Standard for dataStandard are defined by WSDL (Web Service Definition Language).No defined standard.
Example of Protocol usedWeb services used SOAP (Simple Object Access Protocol) protocolWeb APIs uses REST (Representational State Transfer) protocol

Conclusion:

In today’s part of the tutorial, we learned about Web Services and How it is tested. There are different components that are used in Webservices testing like SOAP, UDDI, WSDL. The web service testing is more concentrating on Web Service Request and Response model. Many testers do not understand the exact difference between Web Service and Web API testing, here we covered the difference between them.

Next tutorial >> Tutorial 3 – Web Service Sample Project and it’s Testing

SoapUI Tutorial Series

⇓ Subscribe Us ⇓


If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:


 

Check email in your inbox for confirmation to get latest updates Software Testing for free.


  Happy Testing!!!
 

3 thoughts on “What Is Web Service? How It Is Tested?”

Leave a Comment

Share This Post