Testing SOAP/REST Web Services Using JMeter
Testing SOAP/REST Web Services Using JMeter
Representational State Transfer (REST) uses the HTTP request method with the most popular being: GET, POST, PUT and DELETE.
The responses return status codes indicating success or failure, along with any applicable headers, and JSON representing the affected fields (or nothing) in the message-body.
Read below and you can easily learn how to write a JMeter script with one of these methods!
Let’s start with easiest and most common request method - GET.
1. Add an HTTP Request to your Thread Group.
2. Fill in the Server Name or IP, path, and choose GET method.
For example, we use validate.jsontest.com as Server Name and ‘/’ as path
3. If your API request contain query parameters, you may specify it in path (for example, ‘/?json=[1:1]’) or in Parameters area:
Name: json
Value: [1:1]
PLEASE NOTE THAT THE WEBSERVICE (SOAP) REQUEST IS DEPRECATED. SOAP/XML-RPC REQUEST IS ACTIVE. PLEASE USE THEHTTP_REQUEST INSTEAD.
Representational State Transfer (REST) uses the HTTP request method with the most popular being: GET, POST, PUT and DELETE.
The responses return status codes indicating success or failure, along with any applicable headers, and JSON representing the affected fields (or nothing) in the message-body.
Read below and you can easily learn how to write a JMeter script with one of these methods!
Let’s start with easiest and most common request method - GET.
1. Add an HTTP Request to your Thread Group.
2. Fill in the Server Name or IP, path, and choose GET method.
For example, we use validate.jsontest.com as Server Name and ‘/’ as path
3. If your API request contain query parameters, you may specify it in path (for example, ‘/?json=[1:1]’) or in Parameters area:
Name: json
Value: [1:1]
4. Add View Results Tree, and run script.
Here you’ll find Sampler result, Request and Response data of your request.
Now let’s try POST.
In POST requests you can fill both the body and the headers. You can also specify query parameters in path.
The HTTP headers, which contain metadata, are tightly defined by the HTTP spec; they can only contain plain text and must be formatted in a certain manner.
To specify headers, you’ll need the HTTP Header Manager with the most common headers are Content-Type and Accept.
- The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient.
- Accept can be used to specify certain media types which are acceptable for the response. You can use a user agent to simulate different browsers behaviour.
Post Body can be useful for the following requests: GWT RPC HTTP, JSON REST HTTP, XML REST HTTP and SOAP HTTP Request.
For instance, we use the server name: www.webservicex.net
Path: /periodictable.asmx
Body:
And header: Content-Type: text/xml
You can configure other requests similar to GET and POST, using required methods, path, parameters or body and headers.
PLEASE NOTE THAT THE WEBSERVICE (SOAP) REQUEST IS DEPRECATED. SOAP/XML-RPC REQUEST IS ACTIVE. PLEASE USE THEHTTP_REQUEST INSTEAD.
Check out the results of our HTTP request test
Comments
Post a Comment