Loadrunner 脚本开发-soap_request函数介绍及WebService接口测试

时间:2023-03-08 18:12:36

脚本开发- soap_request函数介绍及WebService接口测试

by:授客 QQ1033553122

函数介绍

soap_request

函数执行一个SOAP请求

函数原型

int soap_request( const char *StepName, ExpectedResponse, URL, , [Attachments,] LAST);

参数说明:

StepName: 函数名称

ExpectedResponse:可接受的响应类型

1)ExpectedResponse=SoapResult: 接受SOAP输出响应,且出现SOAP错误响应则标记失败(Accept SOAP output responses and fail on SOAP faults)

2)ExpectedResponse=SoapFault: 接受SOPA错误响应,且SOAP正常输出响应则标记失败(Accept SOAP faults and fail on SOAP output responses)

3)ExpectedResponse=AnySoap: 接受SOAP输出和SOAP错误响应(Accept both SOAP output and SOAP fault responses.)

URL: WebService需要加载的url地址

XMLEnvelope

用于必备元素列表,使用以下字符串格式:

"Element=value"

SOAPEnvelope: 发送给服务器是XML数据包

Snapshot: 包含函数快照的.inf文件名

ResponseParam:  存储服务器响应的输出参数。

Attachments: 需要发送、接收的附件(可选参数) 详情查阅官方文档 Attachment Specifications

LAST: 表名Specifications  list结束的标记

Web Service接口测试

协议选择

Loadrunner 脚本开发-soap_request函数介绍及WebService接口测试

脚本

Loadrunner 脚本开发-soap_request函数介绍及WebService接口测试


运行结果:

Loadrunner 脚本开发-soap_request函数介绍及WebService接口测试

Loadrunner 脚本开发-soap_request函数介绍及WebService接口测试


对比
SoapUI测试结果

Loadrunner 脚本开发-soap_request函数介绍及WebService接口测试