JMeter implementation WebService interface test

In fact, two jmeter samplers can be used to test webservice:

1, SOAP/XML-RPC Request (but this sampler has been cancelled in jmeter3.2 and later versions)< /p>

2, HTTP request

The two methods are introduced below

First, you need Use the soupUI tool to grab some of the information needed by the webservice interface.

1, create a new project

share picture

2. The newly created project information is as follows:

Share the picture

3. Select the interface to be tested, right click to create a request

Share a picture

4. Edit the message content, click the upper left corner Click the green triangle to execute the button, and view the interface request result in the right window

Share a picture

5. The format of the sent message can be copied






?


Two, use SOAP/XML-RPC Request (but after jmeter3.2 This sampler has been cancelled in the middle of the test. Just put a picture below, because the jmeter version I use is 3.3, there is no SOAP/XML-RPC Request sampler, but the second test form mainly used.

Share picture


   
   
      
         12
      
   

  soapaction address: It is the superimposed content of the first line of data and the fourth line of interface

1   web="http://WebXml.com.cn/"


4  
<web:getTVstationString>

Form the address: http://WebXml.com.cn/getTVstationString
For the public webservice interface, you can use soapUI Grab, or other tools to grab the format of the sent message

Three, use HTTP request sampler to test the webservice interface
1. Create an HTTP request, as shown in the figure. The request content is written in the BODY DATA, and the selection method is post
share picture
xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getSupportCity xmlns="http://WebXml.com.cn/">
<byProvinceName >HenanbyProvinceName>
getSupportCity>
soap:Body>
soap:Envelope>


2, create HTTP header information as follows p>

The Soapaction address is the same as the first method

Share a picture< /p>

3. Then create the next interface request in the same way as above

Share a picture





${b1}


Share a picture

4. The final execution request result is as follows:

Share a picture

share picture


share picture

share picture


   
   
      
         12
      
   

1   web="http://WebXml.com.cn/"


4  
<web:getTVstationString>

xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getSupportCity xmlns="http://WebXml.com.cn/">
<byProvinceName >HenanbyProvinceName>
getSupportCity>
soap:Body>
soap:Envelope>





${b1}


Leave a Comment

Your email address will not be published.