Web Services Testing Tutorial

Web Services Testing tutorial

Web Services Testing Tutorial

In this multi-part web services testing tutorial, we will look at how Web Services testing can be conducted using SoapUI. we will discuss the fundamentals of Web services and Service oriented Architecture in part 1. will discuss Web Services testing using SoapUI in the next two parts.

Let’s understand the Web services before we get into web services testing.

Introduction to Web services

Typical software applications are developed for human interactions, however there are scenarios which requires automated machine to machine interactions without human interventions.

Let’s consider a case of travel booking site. We have a number of such websites like Makemytrip, Cleartrip, Goibibo etc. To buy a ticket, you first search for all the available flights and based on your timing preference and budget, you book a ticket. Do you think, each of these websites, show you similar flight schedules? Actually they do. 

Cleartrip Search: Flight search

Let’s try to book a flight from Mumbai to Bangalore using cleartrip application.

web services examples - Cleartrip

When you click on Search Flights, you get below result showing the flight information. 

Web Services Tutorial 2

So, what do you observe?

The result shows all the flights from Mumbai to Bangalore of different airlines for Sep 6th. What do you think how this could be possible? Are the results that is getting listed in the cleartrip is been fetched from cleartrip database. No not really, what’s happening here is cleartrip application consumes the webservices exposed by a centralized repository.

This centralized source of flight information is known as Global distribution systems (GDS). All the travel sites like MakemyTrip and ClearTrip connect to these GDS servers for getting the real-time flight schedule data. The GDS is known as a web service.

Web services are accessible over the web and are designed to be machine readable so that no human interaction is needed to access the service.Whenever a visitor searches the flight information from one destination to another, these websites fetch the data from the GDS servers based on visitors search criteria. The visitor does not need to go to these websites/servers for fetching the data.

What we discussed above, is an example of machine to machine interaction and web services are designed for these interactions.

How web services are used in Enterprises

We will take an example of a bank. Banks have multiple divisions like home loan, auto loan, banking, credit card etc. Automation of these systems happen at different points in time and possibly using different technology platforms. Over a period of time, these applications need to talk to each other as well. It’s not possible to make them talk to each other, if they are not on the same technology platform. How will a JAVA application talk to a .NET or C++ application? It’s also not feasible to change the platform for each one of them for obvious reasons.

Service oriented architecture is the best suited architecture for these kind of enterprises. Web services are developed around these applications making them universally accessible from any of the applications. In the next section, we are going to discuss the web services technologies and components.

Developing web services

Web services can be created in two ways.

  1. SOAP
  2. REST

Let us learn more about SOAP and REST web services in the below sections.

 SOAP

SOAP is also known as Simple Object Access Protocol. It is a protocol or rule or regulation. In SOAP the request and the response are in the form of XML. XML is used as a medium to exchange data between the applications.

Why SOAP?

  • SOAP works on HTTP protocol. HTTP protocol is the default protocol used by all web applications.
  • SOAP is platform independent. It can work on any programming language-based applications.
  • SOAP has the ability to run on different operating systems both Windows and Linux which communicates using XML.
  • SOAP is used as a medium to talk and exchange data between the applications.

SOAP Message

SOAP message is an XML document. It has the below components.

  1. An envelope which helps us to identify XML document as SOAP message.
  2. Header which contains the header information.
  3. Body which contains call and response information.
  4. Fault which provides information about the errors that occur during the processing of the message. This is optional.

We shall learn more about the SOAP message structure in our upcoming tutorials. As of now we shall understand that the above four components listed forms a SOAP message.

REST

REST is also known as Representational State Transfer. This obeys the REST protocol. In REST, the request is sent in the form of URL and the Response is in the form of either XML or JSON.

Why REST?

  • RESTful webservices focuses in a way where everything we work with is treated as a resource. We either create a resource, overwrite a resource, Modify the state of the resource using various http methods such as GET, POST, PUT, DELETE.
  • REST is stateless which means there is no storage of session data on the client.
  • REST also uses HTTP protocol as medium of communication between the client to the webservice.

REST message

REST message is a simple HTTP request just like a browser sends a request to the server. As mentioned above REST request is sent in the form of URL and the response would be in the form of XML or JSON.

HTTP request has five major components

  1. Verb which Indicates the HTTP methods such as GET, POST, PUT, DELETE and many more.
  2. URI known as Uniform resource locator; this helps us to identify the resource on the server.
  3. HTTP Version
  4. Header Request, this has the metadata information in the form Key-value pair.
  5. Request Body contains the content of the message.

 

Web Services Components

We discussed about machine to machine interactions as one of the key characteristics of a web service. In order to support machine to machine interactions, you need to have the following capabilities in a web service:

  • Platform independence
  • Language independence
  • It also needs to searchable through standard search mechanisms for a machine/program (Self-describing)
  • The interface should be in public domain (that means input and output information should be publicly available)

Let’s see how web services are used by looking at the following diagram:

A web service is the service provider and any application making use of the web service is known as service consumer. The service consumer has to find a service from a service directory. These are the 3 primary components of any web services eco system.

Web services can be public services or can reside within an organization. But, in the given context, they are accessible to any consumer irrespective of the technology platform. So a .net application as well as a java application can consume a web service in a similar manner. That’s the reason, we identified platform and language independence as key characteristics of web services.

Having discussed web services, it’s time to look at a formal definition of web services by W3C:

“A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.”

https://www.youtube.com/watch?v=gtD13fcMdI8

What’s next: We will discuss the terms like WSDL, SOAP etc in Second part of web services testing tutorial.

About Techcanvass

Techcanvass is an IIBA endorsed education provider (EEP), iSQI ATP (for Certified Agile Business Analyst Training) as well as Agile Testing alliance partner for CP-SAT certification training in Selenium.

About Techcanvass

Techcanvass is an IIBA endorsed education provider (EEP), iSQI ATP (for Certified Agile Business Analyst Training) as well as Agile Testing alliance partner for CP-SAT certification training in Selenium.

Techcanvass offers wide range of automation testing courses. These courses include Java and Selenium certification coursePython Selenium Certification courseBDD Training with CucumberRPA Training with UiPathDevOps certification course and more automation testing courses.

CP-SAT Selenium Certification Training