Testing REST/SOAP Web services

A Web service is a method of communication between two applications or electronic devices over the World Wide Web (WWW).

Web services are of two kinds: Simple Object Access Protocol (SOAP) and Representational State Transfer (REST).

What is REST web service?

REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the unique URI and a representation of the resource is returned. With each new resource representation, the client is said to transfer state. While accessing RESTful resources with HTTP protocol, the URL of the resource serves as the resource identifier and GET, PUT, DELETE, POST and HEAD are the standard HTTP operations to be performed on that resource.

The REST architectural style is also applied to the development of web services[6] as an alternative to other distributed-computing specifications such as SOAP. One can characterize web services as "RESTful" if they conform to the following constraints:

  • Client–server - A uniform interface separates clients from servers. This separation of concerns means that, for example, clients are not concerned with data storage, which remains internal to each server, so that the portability of client code is improved. Servers are not concerned with the user interface or user state, so that servers can be simpler and more scalable. Servers and clients may also be replaced and developed independently, as long as the interface between them is not altered.
  • Stateless - The client–server communication is further constrained by no client context being stored on the server between requests. Each request from any client contains all the information necessary to service the request, and session state is held in the client. The session state can be transferred by the server to another service such as a database to maintain a persistent state for a period and allow authentication.
  • Cacheable - As on the World Wide Web, clients can cache responses. Responses must therefore, implicitly or explicitly, define themselves as cacheable, or not, to prevent clients reusing state or inappropriate data in response to further requests. Well-managed caching partially or completely eliminates some client–server interactions, further improving scalability and performance.
  • Layered system - A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way. Intermediary servers may improve system scalability by enabling load-balancing and by providing shared caches. They may also enforce security policies.
  • Uniform interface - The uniform interface constraint is fundamental to the design of any REST service.The uniform interface simplifies and decouples the architecture, which enables each part to evolve independently. The four guiding principles of this interface are: Identification of resources, Manipulation of resources through these representations, Self-descriptive messages and Hypermedia as the engine of application state.

How to Test RESTful web services using BlazeMeter

You can test RESTful web services by creating scripts in JMeter and uploading them and executing in BlazeMeter.

In JMeter, REST uses the HTTP request method with the most popular being: GET, POST, PUT and DELETE.The responses return status codes indicating success or failure, along with any applicable headers, and JSON representing the affected fields (or nothing) in the message-body.


How to write a JMeter script for REST web service

Let’s start with easiest and most common request method - GET.

  1. Add an HTTP Request to your Thread Group.
  2. Fill in the Server Name or IP, path, and choose GET method. For example, we use as Server Name and ‘/' as path
  3. If your API request contain query parameters, you may specify it in path (for example, ‘/?json=[1,1]’) or in Parameters area:  Name: json and Value: [1,1]
  4. Add View Results Tree, and run script. Here you’ll find Sampler result, Request and Response data of your request.

Now let’s try POST.

In POST requests you can fill both the body and the headers. You can also specify query parameters in path.

To specify headers, you’ll need the HTTP Header Manager with 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 which are acceptable for the response. You can use a user agent to simulate different browsers behavior.

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

Note: You can directly use a REST sampler using JMeter plugins.( - REST Sampler).

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

What are SOAP Web Services ?

SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP. The standard protocol HTTP makes it easier for SOAP model to tunnel across firewalls and proxies without any modifications to the SOAP protocol. SOAP can sometimes be slower than middleware technologies like CORBA or ICE due to its verbose XML format.


How to Test SOAP web services using BlazeMeter ?

You can test SOAP web services similar to REST services by creating JMeter scripts and executing them through BlazeMeter.

We need to provide the SOAP request URL, SOAP Action and SOAP/XML RPC data.

  1. Add a SOAP/XML-RPC Request to your Thread Group.
  2. Fill in the URL path, For example, we use
  3. Now in the Soap/XML-RPC Data section enter the data in XML format.
  4. Add View Results Tree, and run script. Here you’ll find Sampler result, Request and Response data of your request.

Note: In Soap/XML-RPC Request only the URL field is mandatory. You can check "Send SOAPAction and pass action value.

Have more questions? Submit a request


Please sign in to leave a comment.