Web Service性能测试研究

发表于:2009-6-30 11:59

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

 作者:黄进青    来源:51Testing博客

  4.3   问题

  按照上面的步骤执行脚本,发现有错,提示信息如下:

点击查看大图

  该问题暂时无法解决,需要再进一步的研究,现用soap_request函数实现webservice的测试。

  本文出自黄进青的51Testing软件测试博客:http://www.51testing.com/?65519

  版权声明:原创作品,转载请保留链接,标明本文原始出处、作者信息和本声明,否则将追究法律责任。

  4.4   实现webservice测试

  使用web_add_header(用户添加webservice头)、soap_request(用户向服务器发送webservice请求)、lr_convert_string_encoding(用于将webservice请求的XML转换为UTF-8格式,必须要转换为UTF-8格式,否则在请求的XML中如果含有中文字符的话将会请求失败)、和lr_eval_string(用于向soap_request函数传递转换后的UTF-8格式参数值)函数实现webservice测试,代码如下:

Action()

{

int rc = 0;

unsigned long converted_buffer_size_unicode = 0;

char *converted_buffer_unicode = NULL;

char *strnew = NULL;

 

web_add_header("SOAPAction",

              "\"\"");

web_add_header("User-Agent",

              "Jakarta Commons-HttpClient/3.1");

web_add_header("Content-Type",

              "text/xml;charset=UTF-8");

 

strnew=  "SOAPEnvelope= <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://webservice.qr.ufmobile.cn/\">   <soapenv:Header/>   <soapenv:Body>      <web:uploadException><arg0>{NewParam_1}</arg0><arg1>number</arg1><arg2>有实物无帐</arg2><arg3>该产品没有入账</arg3><arg4>77804179</arg4><arg5>huangjq</arg5><arg6>96</arg6></web:uploadException></soapenv:Body></soapenv:Envelope>";

 

rc = lr_convert_string_encoding(strnew,

       LR_ENC_SYSTEM_LOCALE,

       LR_ENC_UTF8,

       "new");

 

//上传异常盘点信息

soap_request("StepName=login",

"URL=http://10.192.17.40/PanasonicQR/MobileService/UploadInventoryService",

              lr_eval_string("{new}"),

              "Snapshot=t1.inf",

              "ResponseParam=result",

              LAST);

       return 0;

}

43/4<1234>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

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

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

沪ICP备05003035号

沪公网安备 31010102002173号