Web Services Testing Tutorial: How to Test? Learn with Example

What is WebService?

Web Services is the mechanism or the medium of communication through which two applications / machines will exchange the data irrespective of their underline architecture and the technology.

What is Web Service Testing?

Web Services Testing is a type of software testing that validates Web services. The purpose of Web Services Testing is to check the functionality, reliability, performance, and security of an API(Application Program Interface). Web Service Testing is similar to unit testing in some cases. You can test a Webservice manually or create your own automation code or use an off-the shelf automation tool like Postman.

Why is WebService Needed?

In general, software applications are developed to be consumed by the human beings, where a person sends a request to a software service which in-turn returns a response in human readable format.

In the modern era of technology if you want to build a software application you don’t need to build each and everything from scratch. There are lots of readymade services available which you can plug into your application and you can start providing those services in your application.

For example you want to display weather forecast information you don’t need to collect, process and render the data in your application. You can buy the services from the people who already well-established in processing and publishing such kind of data.

Web services allow us to do these kind of implementations.

As an example, consider the following WebService


It gives Share Value for a Company.

Let’s find share price for Google (Symbol: GOOG )

Web Service Testing

The response XML gives the stock price.

Web Service Testing

This WebService can be called by a Software Application using SOAP or HTTP protocol.

Web Service Protocols

Web Services can be implemented in different ways, but the following two are the popular implementations approaches.

  1. SOAP (Simple Object Access Protocol)
  2. REST (Representational State Transfer architecture)


SOAP is a standard protocol defined by the W3C Standard for sending and receiving web service requests and responses.

SOAP uses the XML format to send and receive the request and hence the data is platform independent data. SOAP messages are exchanged between the provider applications and receiving application within the SOAP envelops.

As SOAP uses the simple http transport protocol, its messages are not got blocked by the firewalls.


REST means REpresentational State Transfer; it is an architecture that generally runs over HTTP. The REST style emphasizes the interactions between clients and services, which are enhanced by having a limited number of operations. REST is an alternative to SOAP (Simple Object Access Protocol) and instead of using XML for request REST uses simple URL in some cases. Unlike SOAP, RESTFUL applications uses HTTP build in headers to carry meta-information.

There are various code that REST use to determine whether user has access to API or not like code 200 or 201 indicates successful interaction with response body while 400 indicates a bad request or the request URI does not match the APIs in the system. All API request parameters and method parameters can be sent via either POST or GET variables.

Rest API supports both XML and JSON format for WebServices API Testing. It is usually preferred for Mobile and web apps as it makes app work faster and smoother


WSDL (Web Services Description Language) is an XML based language which will be used to describe the services offered by a web service.

WSDL describes all the operations offered by the particular web service in the XML format. It also defines how the services can be called, i.e what input value we have to provide and what will be the format of the response it is going to generate for each kind of service.

How to test a Web Service?

To test web service, you can

  1. Test Manually
  2. Create your own Automation Code
  3. Use an off-the shelf automation tool like SoapUI.

Web Services Automation Testing involves following steps –

  1. Understand the WSDL file
  2. Determine the operations that particular web service provides
  3. Determine the XML request format which we need to send
  4. Determine the response XML format
  5. Using a tool or writing code to send request and validate the response

Suppose we want to test web service which provides Currency Conversion Facility. It will the current conversion rates between the different countries currency. This service we can use in our applications to convert the values from one currency to the other currency.

Now lets look at above steps

Step 1 to 4: Understanding WSDL and determining operations & XML formats

Currency Convertor WSDL file can be seen @ (http://www.webservicex.net/CurrencyConvertor.asmx?wsdl) which will give the information about the Currency Convertor web service methods which it will support, the parameter which we need pass and the type of parameters… etc.

WSDL and determining operations & XML formats

WSDL and determining operations & XML formats

Step 5: Using a tool or writing code to send request and validate the response

There are lots of WebService Test tools available to test SOAP web service. SoapUI is one of the popular API tool which will help us to test SOAP web services. In fact you can use the any programing language which is capable of sending the XML request to the web service provider application over the http and able to parse and validate the response XML against the expected result. In this Web Services Testing tutorial, we will test the WebService

  1. Using Java
  2. Using SoapUI

PART 1) WebService Testing Using Apache Axis2 API (Java).

Generally web service takes the request and sends the response in the XML format.

Apache Axis2 API project is a Java implementation API, which will be used to create the Web services for both server side (service provider) and client side (service consumer).

Axis2 is capable of sending SOAP messages and Receives & Processes the SOAP messages. We can write a small Java program using the API to create the web service. Axis2 will generate the WSDL from Java program which will be used to communicate the services offered by the web service. We can use the same Axis2 to generate the Java class (stub) from WSDL file which we can use as a client program to generate the web service request, to send the request to the service end point and to process the response.

  1. Basically we will create a simple Java program in which we will instantiate the stub class.
  2. Using the stub we will invoke the request method by passing all the required information.
  3. Stub program will convert that request into XML request format and sends it the service end point which will read the request and processes the request and sends the response in XML format.
  4. The XML response will be converted into Java class by stub and returned to the actual program.

Let’s look at above steps in detail

Step a) Download the axis2 API @ https://axis.apache.org/axis2/Java/core/download.cgi & Set the environment variable ‘AXIS2_HOME’

WebService Testing Using Apache Axis2 API (Java)

Step b) Create a folder to keep all the generated artifacts

Ex : C:\Axis\Projects\CurrencyConverter

Step c) Open the command prompt and navigate to the folder structure where you want to generate the artifacts and Run the following command which will generate the stubs

%AXIS2_HOME%\bin\WSDL2Java -uri http://www.webservicex.net/CurrencyConvertor.asmx?wsdl -p org.apache.axis2.currencyconvertor -d adb –s

WebService Testing Using Apache Axis2 API (Java)

Step d) Once the command is successfully run, you will see the folder with required files.

WebService Testing Using Apache Axis2 API (Java)

Step e)In the next step of this Web Services Testing tutorial, we have to create the client program, through which we will send the actual request using the generated stubs. Open the eclipse and create the new Java project and select the folder which we have created above.

WebService Testing Using Apache Axis2 API (Java)

Step f) Add all the axis2 related jars to project build path, which will be there in lib folder of the axis2 software folder

(for ex : C:\Axis\axis2-1.6.2\lib)

WebService Testing Using Apache Axis2 API (Java)

Step g) Create a new Java class (ex : Client.Java) and instantiate stub object. Using the stub object we can call all the supported methods of the particular WebService.

WebService Testing Using Apache Axis2 API (Java)

Client.Java Program
package org.apache.axis2.currencyconvertor;
import org.apache.axis2.currencyconvertor.CurrencyConvertorStub.ConversionRate;
import org.apache.axis2.currencyconvertor.CurrencyConvertorStub.ConversionRateResponse;
import org.apache.axis2.currencyconvertor.CurrencyConvertorStub.Currency;

public class Client {
 public static void main(Java.lang.String args[]) {

  try {

       //Create the stub object by passing the service end point url
       CurrencyConvertorStub stub = new CurrencyConvertorStub("http://www.webservicex.net/CurrencyConvertor.asmx");
       //ConversionRate is the class which we have to use mention the from and to currency
       //ConversionRate object will be the parameter for the conversionRate operation
       ConversionRate conversionRate = new ConversionRate();

       //Create the ConversionRateResponse object, which is going to be used to catch the response
       //call the conversionRate service using the stub object
       ConversionRateResponse conversionRateResponse = stub.conversionRate(conversionRate);

       //We can use the conversionRateResponse object to retrieve the response of the ConversionRate Service
       System.out.println("Conversion Rate from INR to USD : " + conversionRateResponse.getConversionRateResult());

       } catch (Exception e) {

PART 2) How to Test Using SoapUI Web Service

In SoapUI

  1. Go to File > New Soap Project
  2. Enter the project Name and the WSDL URI location
  3. Click OK

Test Using SoapUI Web Service

  1. Expand the first request and double click on the ‘Request1’. It will display the SOAP request in the XML format.
  2. Enter the From Currency and To Currency
  3. Click on the submit button
  4. Response XML will be displayed right side pane.

Test Using SoapUI Web Service

As you may conclude, usage of WebService Test tools like SoapUI expedites your Web Services Automation Testing Effort. Hence SoapUi will be focus of our learning in the succeeding tutorials.


  • Software Applications communicate and exchange data with each other using a WebService
  • SOAP and REST are 2 popular protocols to create a WebService
  • SOAP supports XML based data exchange
  • REST support XML, Json or exchange of data in simple URL for WebServices API Testing.
  • WSDL is XML based language which will be used to describe the services offered by a web service. SOAP is defined using WSDL.
  • To test WebService you can
    • Create your own code. For instance use Axis2 API for Java
    • Use WebService Test Automation tools like SoapUI
  • Automation Tools like SoapUI will jumpstart your Web Services Automation Testing efforts, will require less coding effort compared to creating your own code using Axis2 API


Web Service Web API
Defined by W3C, all communication & data exchange is based on XML Web API communication & data exchange could be XML, JSON or plain data
It has defined standards – WSDL No defined standard
You cannot compress the data but you can compress the HTML request You can compress the data
Example: SOAP Example: REST

Learn more about Web API Testing

This Web Services Testing tutorial is made possible with contributions of Mr. Narender Reddy Nukala