web:byProvinceName?</web:byProvinceName>
</web:getSupportCity>
</soap:Body>
</soap:Envelope>
二、使用SOAP/XML-RPC Request(但是在jmeter3.2以后版本中已经取消了这个取样器)形式进行测试,以下随便放一张图,因为我用的jmeter版本是3.3,么有SOAP/XML-RPC Request sampler,而是主要用的第二种测试形式。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://WebXml.com.cn/">
<soapenv:Header/>
<soapenv:Body>
<web:getTVstationString>
<web:theAreaID>12</web:theAreaID>
</web:getTVstationString>
</soapenv:Body>
</soapenv:Envelope>
soapaction的地址:为第1行数据和第4行接口的相叠加的内容
1 web="WebXml.com.cn/"
4 web:getTVstationString
形成地址:WebXml.com.cn/getTVstatio…
对于公共的webservice接口,可以使用soapUI进行抓取,或者是其他工具去抓取发送报文的格式
三、使用HTTP请求sampler来测试webservice接口
1、建立HTTP请求,如图,请求内容写在BODY DATA里,选择方法为post
<?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>河南</byProvinceName>
</getSupportCity>
</soap:Body>
</soap:Envelope>
2、建立HTTP头信息,如下
Soapaction地址和第一种方法一致
3、接着建立下一个接口请求,方式同上
<?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>
<getWeatherbyCityName xmlns="http://WebXml.com.cn/">
<theCityName>${b1}</theCityName>
</getWeatherbyCityName>
</soap:Body>
</soap:Envelope>
4、最终执行的请求结果如下图:
最后感谢每一个认真阅读我文章的人,看着粉丝一路的上涨和关注,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走!