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.
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-
- Add a Thread Group, name it and configure it with the required values for Number of Threads, Ramp-up and Loop count.
- Within the Thread Group, add a “SOAP/XML-RPC Request” sampler.
Right Click on Thread Group -> Hover over Add -> Sampler -> SOAP/XML-RPC Request.
- 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.
- Add the desired Listeners like – View Result Tree.
- Schedule and run the test with the 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).
That’s all we have in this section, please share it with your friends and colleagues. Check out the complete JMeter tutorial below.