51Testing丛书:性能测试进阶指南—LoadRunner 11实战(18)

发表于:2012-6-06 11:20

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:陈霁    来源:51Testing软件测试网原创

分享:

  在Operation下拉列表中列出了该Service所提供的所有操作接口,而下方提供了该接口的输入/输出结构。

  这里我们做一个简单的业务流程,用户首先查询自己所在城市的城市编号,再通过编号查询得到对应城市的天气情况。

  方法getSupportCityString提供了对于城市查询返回对应编号的服务,这里选择该Operation,并且在Input Arguments中输入我们需要查询的城市名称“上海”(可以参数化),如图8.25所示。

图8.25  访问getSupportCityString服务

  单击OK按钮完成调用,生成对应的代码:

web_service_call( "StepName=getSupportCityString_101",
"SOAPMethod=WeatherWS|WeatherWSSoap|getSupportCityString",
"ResponseParam=response",
"Service=WeatherWS",
"ExpectedResponse=SoapResult",
"Snapshot=t1320732864.inf",
BEGIN_ARGUMENTS,
"theRegionCode=上海",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);

  对于Web_service_call函数,自身就提供了关联返回的功能,该请求的返回会保存在参数response和getSupportCitystring_101_response中。我们启动日志运行该函数检查服务器返回,代码如下:

Action.c(4): Notify: Saving Parameter "getSupportCityString_101_Response = <getSupportCityString><getSupportCityStringResult><string>宝山,2009</string><string>崇明,2012</string><string>奉贤,2063</string><string>嘉定,2011</string><string>金山,3530</string><string>闵行,2008</string><string>南汇,2014</string><string>浦东,2015</string><string>青浦,2061</string><string>上海,2013</string><string>松江,3413</string><string>徐家汇,3643</string></getSupportCityStringResult></getSupportCityString>".
Action.c(4): Notify: Saving Parameter "response = <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getSupportCityStringResponse xmlns="http://WebXml.com.cn/"><getSupportCityStringResult><string>瀹濆北,2009</string><string>宕囨槑,2012</string><string>濂夎搐,2063</string><string>鍢夊畾,2011</string><string>閲戝北,3530</string><string>闂佃,2008</string><string>鍗楁眹,2014</string><string>娴︿笢,2015</string><string>闈掓郸,2061</string><string>涓婃捣,2013</string><string>鏉炬睙,3413</string><string>寰愬姹\x87,3643</string></getSupportCityStringResult></getSupportCityStringResponse></soap:Body></soap:Envelope>".

32/3<123>
价值398元的测试课程免费赠送,填问卷领取吧!

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计

法律顾问:上海漕溪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2022
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号