2012-11-13

Testing Web Service(SOAP/XML-RPC) using JMete

 
In this article, we are going to see a very simple web service testing procedure using JMeter.
Scenario : We are going to test a web service where the service provide us data . To be specific, the service link is http://www.webservicex.net/periodictable.asmx, the Data action link http://www.webservicex.net/periodictable.asmx?op=GetAtoms. The functionality of the service is to provide atom names in tabular format. As we are testing the data service, we can not see the HTML table, but if we can get the data, that will solve the purpose of Testing data service. 
So, if we follow those steps, we can see a very simple test for web services.

Step 1. Run JMeter(jmeter.bat) from stored location “apache-jmeter-2.8\bin”

Step 2. Create a Thread Group( right click test plan –>Add –> Thread Group) and rename as SOAPThread(I am using this name).

Step 3 : Put Number of Threads(User) as 20( I am using ) and Ramp-Up Period as 2( I am using)

Step 4. Save the Thread Group. 

Step 5 . Add a Sampler “SOAP/XML-RPC Request” under your thread group
 

Step 6. Add "http://www.webservicex.net/periodictable.asmx" as the URL and "http://www.webserviceX.NET/GetAtoms" as the Send SoapAction
 

Step 7 . Add This following request as “SOAP/XML-RPC Data”(link or Drive)
 

So, there might be a question , where I get the this XML code. It’s simple, from the service link (http://www.webservicex.net/periodictable.asmx) , you will get the GetAtoms function. 
 
If you click GetAtoms , then you will get the function definition of different  XML format(http://www.webservicex.net/periodictable.asmx?op=GetAtoms). I use SOAP 1.1 format
 

Step 8. Add Listener to your thread group(I have added view result tree, view result in table)
 

Step 9 . Now, Run the Thread Group from Menu. 
Its done. We have make and run the service test using jmeter, lets observe the results.
Here is the Request of a sample under tree listener.
 

This is the response data( the tabular format atom names) [Note : we don’t need to check the format as we are not checking the font end. If the data is present, that is ok.
 
Here is table results.
 
I am inspired by this post.….. Thanks …. :)

We can do the same test using WebService(SOAP) Request which is another type of sampler. I am adding the screenshot in Google drive. This is more smarter than SOAP/XML-RPC Request. But, a little bit slower.