1. 打开Jmeter,新建线程组,并添加一个SOAP/XML-RPC Request取样器。
2. 在URL输入栏输入地址:http://www.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl
3. 在Send SOAPAction输入栏输入选择的接口的soapaction,如http://WebXml.com.cn/getWeather
以下为getWeather:
SOAP 1.1
以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。
POST /WebServices/WeatherWS.asmx HTTP/1.1 Host: www.webxml.com.cn Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://WebXml.com.cn/getWeather" <?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> <getWeather xmlns="http://WebXml.com.cn/"> <theCityCode>string</theCityCode> <theUserID>string</theUserID> </getWeather> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?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> <getWeatherResponse xmlns="http://WebXml.com.cn/"> <getWeatherResult> <string>string</string> <string>string</string> </getWeatherResult> </getWeatherResponse> </soap:Body> </soap:Envelope>
SOAP 1.2
以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。
POST /WebServices/WeatherWS.asmx HTTP/1.1 Host: www.webxml.com.cn Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <getWeather xmlns="http://WebXml.com.cn/"> <theCityCode>string</theCityCode> <theUserID>string</theUserID> </getWeather> </soap12:Body> </soap12:Envelope>
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <getWeatherResponse xmlns="http://WebXml.com.cn/"> <getWeatherResult> <string>string</string> <string>string</string> </getWeatherResult> </getWeatherResponse> </soap12:Body> </soap12:Envelope>
4. 在Soap /XML-RPC Data输入请求信息,比如:
<?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>
<getWeather xmlns="http://WebXml.com.cn/">
<theCityCode>2013</theCityCode>
<theUserID></theUserID>
</getWeather>
</soap:Body>
</soap:Envelope>
5. 添加一个响应断言,响应字段选择“响应文本”,匹配规则选择“包括”,添加测试的模式,输入“上海”。
6. 添加查看结果树,可查看服务器返回数据。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。