content:
- Create a WebService interface to simulate the server
- Download SoapUI
- Create a new MathUtil.wsdl file
- Create a SOAP project
- Interface simulation server configuration and startup
[Explanation]: First of all, we should have encountered a common problem. After JMeter 3.2, there is no WebService (SOAP) Request. Later, after querying online information, we learned that we can actually use HTTP request to operate, and the result is the same.
For specific information, you can refer to the original text " Jmeter Test SOAP Protocol (Jmeter 3.3) " Thanks to the author: stone9159
【step】:
1. Create a WebService interface to simulate the server
It is best if you have an interface address, but because I don't have an interface address, I manually create a WebService interface to simulate the server by myself.
Reference: " SoapUI5.0 Creates WebService Interface Simulation Server " Thanks to the author: sean-zou
1. First, you need to download SoapUI : official download address: https://www.soapui.org/downloads/latest-release.html
After downloading, just click Next to install it, no need to state it here.
2. Using SoapUI to create a WebService interface to simulate the server requires an interface description file
New file: MathUtil.wsdl
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://sean.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sean.com" xmlns:intf="http://sean.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://sean.com" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="add"> <complexType> <sequence> <element name="x" type="xsd:int"/> <element name="y" type="xsd:int"/> </sequence> </complexType> </element> <element name="addResponse"> <complexType> <sequence> <element name="addReturn" type="xsd:int"/> </sequence> </complexType> </element> </schema> </wsdl:types> <wsdl:message name="addResponse"> <wsdl:part element="impl:addResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="addRequest"> <wsdl:part element="impl:add" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="MathUtil"> <wsdl:operation name="add"> <wsdl:input message="impl:addRequest" name="addRequest"> </wsdl:input> <wsdl:output message="impl:addResponse" name="addResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="MathUtilSoapBinding" type="impl:MathUtil"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="add"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="addRequest"> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="addResponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="MathUtilService"> <wsdl:port binding="impl:MathUtilSoapBinding" name="MathUtil"> <wsdlsoap:address location="http://localhost:8080/webservice_create/services/MathUtil"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
3. Open SoapUI and create a SOAP project in SoapUI through the MathUtil.wsdl file:
After confirmation, the simulated client will be automatically generated under the newly created SOAP project
Create an interface mock server (Mock Service) based on the mock client:
After confirmation, double-click [Response1]
The return value defaults to "?" and must be modified, otherwise an error will be reported when calling this interface
4. Interface simulation server configuration and startup
Double-click the created interface to simulate the server: