How to perform Web Services Testing using HTTPClient

Web Services Testing

Download – HTTP Client  from below link and extract the zip file and add all jars into project 


JSON Jar to read json format.


Web Services Testing


Before moving to test Web Services Testing, please go through the basics of Web Service.

Please check below article from W3School

Intro to WebServices

We will be testing Web Services in two ways

1- Using JSON File.

2-Using XML File.


How to verify HTTP Response for Web Service Testing

First we will verify HTTP response using response code below

Status codes

Most status codes which frequently used

200- Ok

404- Page not found

401- Unauthorized


Below is the piece of code which will verify HTTP Response


How to verify the response Content type for Web Services testing

public static void testMimeType(String restURL, String expectedMimeType) throws ClientProtocolException, IOException {


How to extract response from XML File for Web Services Testing


How to extract response from JSON File for Web Services Testing


Full program for Web Services Testing


If you find this useful then please share with friends. Comment below if any doubt, suggestion or feedback.

Thanks for visiting my blog. Have a nice day 🙂

For More updates Learn Automation page

For any query join Selenium group- Selenium Group




  1. Preetish Kumar Mahato
  2. Fayaz