SOAP Web Service Testing using JMeter


In this post we'll see how to test a SOAP web service in JMeter. Using JMeter, we can do both functional testing as well as load testing of a SOAP web services. As we know that web services are headless so, we can't use the record and playback feature of JMeter to record the web service requests. Hence, we need to create the Sampler requests manually. In this tutorial, we will use the S"OAP/XML-RPC Request" sampler to create and send the SOAP request.

SOAP/XML-RPC Request

The SOAP/XML-RPC Request sampler is used to send a SOAP or an XML-RPC request to a webservice. This sampler creates an HTTP POST request(as SOAP is based POST method) with the request body specified in the "SOAP/XML-RPC Data" field. We can specify the SOAPAction in the SOAPAction field after checking the Send SOAPAction checkbox.

Steps to test a SOAP Web service using JMeter-

  1. Add a Thread Group, name it and configure it with the required values for Number of Threads, Rampup and Loop count.
  2. Within the Thread Group, add a "SOAP/XML-RPC Request" sampler.
    Right Click on Thread Group -> Hover over Add -> Sampler -> SOAP/XML-RPC Request.
  3. Configure the "SOAP/XML-RPC Request" sampler-
    • Specify the SOAP Web Service WSDL URL.
    • If SOAPAction is required then - Check the SOAPAction checkbox and specify its value. Otherwise, you can keep the checkbox unchecked and field blank.
    • Place the SOAP request in the "SOAP/XML-RPC Data" field. SOAP Web service testing using JMeter
  4. Add the desired Listeners like - View Result Tree.
  5. Schedule and run the test with desired number of Users in the Thread Group.

We can improve the test by adding "CSV Data Set Config" to parameterize the test by fetching the test data from an external file. Furthermore, we can add "Assertions" to validate the web service response (especially used in functional testing).