JMeter Tutorial -- SOAP API Test |
Subscribe me on new discussions

JMeter Tutorial -- SOAP API Test

Views: 60

Hello, welcome to another Article of API test. To know about API & Web Services, visit my previous article.

We have already discussed about Rest API in the previous article. In this article we will discuss about Soap API.

SOAP API (Simple Object Access Protocol)

SOAP is a XML-based protocol for accessing web services over HTTP. It has some specification which could be used across all applications.

SOAP is known as the Simple Object Access Protocol, but in later times was just shortened to SOAP v1.2. SOAP is a protocol or in other words is a definition of how web services talk to each other or talk to client applications that invoke them.

SOAP was developed as an intermediate language so that applications built on various programming languages could talk easily to each other and avoid the extreme development effort.

How to test SOAP API using JMeter


Step 1 - Start JMeter & Create Thread Group

  • Download JMeter from here.
  • Extract the zip file in your preferred location
  • In the bin folder there will be a jmeter.bat file, run it.
  • Add Thread group Test plan(right click)>Add>Thread Group>New Thread Group

Step 2 - ADD HTTP sampler

  • Add sampler Thread Group(right click)>Add>Sampler>HTTP Request
  • Suppose we want to test a simple calculator web service as an example. You can do simple Add, Subtract, Multiply and Divide operations.
  • In this test we'll test only one operation i.e. Add
  • Lets name the sampler Soap Request - Addition
  • Server name :
  • Path : /calculator.asmx
  • Select method as POST as we are giving values to get response from their server
  • In calculator web service you can something like this
  • Copy the payload(soap body) and paste it inside Body Data of HTTP sampler
  • Suppose we want to perform addition operation of 13 & 7.

Step 3 - ADD HTTP Header Manager

The HTTP Header Manager lets you customize what information JMeter sends in the HTTP request header. This header includes properties like "User-Agent", "Pragma", "Referer", etc.

  • Add Config element Thread Group(right click)>Add>Config element>HTTP Header Manager
  • Copy two things from calculator Add.
  • Content-Type: text/xml; charset=utf-8
  • SOAPAction: ""
  • These two parameters should be mentioned as the test will be executed depending on these two parameters.

Step 4 - Run & Validate

Our test is ready, all we need is a listener to see result of the test. We will use Results Tree to validate the test.

  • Add listener Thread Group(right click)>Add>Listener>View Results Tree
  • Click on Start button.

First check the Request Headers file that we have requested through Header Manager,

  • Here we can see that both the parameters we have mentioned inside HTTP Header Manager are listed inside Request Headers

Now check the Request body we have sent through HTTP sampler,

  • Here we can see two things i.e. The request by POST method and the payload(SOAP body)

Lastly, check the Response body to verify the operation,

  • We have started the test to perform addition operation of 13 & 7 , and we get result as 20

We can clearly see that our purpose of doing this test i.e.addition operation of 13 & 7 is successful. This is a simple example of SOAP API test performed by JMeter. Try other operations like Multiply, Divide, Subtract etc using the instructions .

Thanks for reading.

Karma: {{ total }}
Published: 7 months ago by Raja