jMeter - Webservice Test Plan


In this chapter, we will learn how to create a Test Plan to test a WebService. For our test purpose, we have created a simple webservice project and deployed it on the Tomcat server locally.

Create Webservice Project

To create a webservice project we have used Eclipse IDE. First write the Service Endpoint Interface HelloWorld under the package The contents of the are as below:


import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

//Service Endpoint Interface
@SOAPBinding(style = Style.RPC)
public interface HelloWorld{

@WebMethod String getHelloWorldMessage(String string);


This service has a method getHelloWorldMessage which takes String paramater.

Next create the implementation class under the package


import javax.jws.WebService;

public class HelloWorldImpl  implements HelloWorld  {
	public String getHelloWorldMessage(String myName){
		return("Hello "+myName+" to JAX WS world");


As a next step let's publish this web service locally by creating the Endpoint publisher and expose the service on the server.

The publish method takes two parameters:

  • Endpoint URL String.

  • Implementor object, in this case the HelloWorld implementation class, which is exposed as a Web service at the endpoint identified by the URL mentioned in the parameter above.

The contents of is a follows :

package com.tutorialspoint.endpoint;



public class HelloWorldPublisher {

	public static void main(String[] args){
		Endpoint.publish("http://localhost:9000/ws/hello", new HelloWorldImpl());

Next modify the web.xml as below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, 
Inc.//DTD Web Application 2.3//EN"

To deploy this application as webservice we would need another configuration file sun-jaxws.xml, the contents of this file are as below:

<?xml version="1.0" encoding="UTF-8"?>

Now that all the files are ready the directory structure would look like as in the image below:

Webservice Dir structure

Now create a WAR file of this application. Choose the project > right click > Export > WAR file. Save this as hello.war file under the webapps folder of Tomcat server. Now start the Tomcat server. Once the server is started, you should be able to access the webservice with the following URL:


Create JMeter Test plan

Now let's create a test plan to test the above webservice.

Rename Test Plan

Start the JMeter window by clicking on /home/manisha/apache-jmeter-2.9/bin/ Click on the Test Plan node. Rename this Test Plan node as WebserviceTest.

WS Test Plan

Add Thread Group

Add one Thread Group, which is placeholder for all other elements like Samplers, Controllers, Listeners. Right click on WebserviceTest(our Test Plan) > Add > Threads(Users) > Thread Group. Thread Group will get added under the Test Plan (WebserviceTest) node.

Next let us modify the default properties of the Thread Group to suit our testing. Following properties are changed:

Name: webservice user

Number of Threads (Users): 2

Ramp-Up Period: leave the the default value of 0 seconds.

Loop Count:2

WS Test Users

Add Sampler-SOAP/XML -RPC Request

Now that we have defined our users, it is time to define the tasks that they will be performing. We will add SOAP/XML-RPC Request element. Click your right mouse button to get the Add menu, and then select Add > Sampler > SOAP/XML-RPC Request. Then, select the SOAP/XML-RPC Request element in the tree and edit the following properties as in the image below:

The following details are entered in the this element:

Name: SOAP/XML-RPC Request

URL: http://localhost:8080/hello/hello?wsdl

Soap/XML-RPC Data: Enter the below contents

<soapenv:Envelope xmlns:soapenv="" xmlns:web="">
WS Test request

Add Listener

The final element you need to add to your Test Plan is a Listener. This element is responsible for storing all of the results of your HTTP requests in a file and presenting a visual model of the data.

Select the webservice user element and add a View Results Tree listener (Add > Listener > View Results Tree).

WS Test request

Run the Test Plan

Now save the above test plan as test_webservice.jmx. Execute this test plan using Run > Start option.

View Output

The following output can be seen in the listener.

WS Test Result WS Test Result WS Test Result

In the last image you can see the response message "Hello Manisha to JAX WS world".