February 7, 2019

How to Performance Test Web Services Using JMeter

Open Source Automation
Performance Testing

It's important to performance test web services — whether you have SOAP or REST APIs. In this blog, we break down how to performance test web services with JMeter.

Table of Contents:


What Is Web Service Performance Testing?

Web service performance testing involves testing the scalability of your web services with varying user load. This type of performance testing simulates real-life user load for the targeted web services (SOAP or REST). 


How to Performance Test Web Services

Here are two options for performance testing web services.

For REST APIs, the Representational State Transfer (REST) uses the HTTP request method. The most popular are GET, POST, PUT, and DELETE. Responses to these requests return status codes indicating success or failure as well as any applicable headers, and JSON representing the affected fields (or nothing) in the message body. 

The first two methods — GET and POST — are what we'll cover for testing web services.

Option 1: Get Request Method


1. Add an HTTP Request to your Thread Group.


2. Fill in the Protocol, Server Name or IP, Path, and choose GET method.


For example, we use

https for Protocol

jsonplaceholder.typicode.com for Server Name
/todos/1 for Path

A screenshot of an HTTP request.

4. Add View Results Tree, and run your script. The following show the Sampler result, Request, and Response data. 

A screenshot of View Results Tree.

Option 2: Post-Request Method


In POST requests, you can fill in both the body and the headers. You can also specify query parameters in path. The HTTP headers, which contain metadata, are tightly defined by the HTTP spec. They can only contain plain text and must be formatted in a certain manner. To specify headers, you’ll need the HTTP Header Manager, and the most common headers are Content-Type and Accept.


- The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient.


- Accept can be used to specify certain media types that are acceptable for the response. You can use a user agent to simulate different browsers' behaviors.


Post Body can be useful for the following requests: GWT RPC HTTP, JSON REST HTTP, XML REST HTTP, and SOAP HTTP Request.


For instance, we use the server name:



Path: /calculator.asmx

Method: POST



<?xml version="1.0" encoding="utf-8"?>







And header:

Content-Type text/xml; charset=utf-8

You can configure other requests (similar to GET and POST) using required methods, path, parameters, or body and headers. 

Next go into “View Result Tree” Listener is possible to verify sample response

A screenshot for the View Result Tree listener.


Select the sample on left panel and choose XML visualization (as shown in above picture). Into response detail we can see response structure and data returned.


Performance Test Web Services With BlazeMeter

With BlazeMeter, you can also run all of your JMeter scripts in the cloud and get enhanced features and reporting.