请高手帮忙-测试Flex协议时,解析服务器端返回的xm数据l
使用http协议来对flex的网站进行测试;由于服务器端和客户端都是基于xml进行文件的交互,所以想用loadrunner自带的lr_xml_get_values函数保存一些服务器端的结果,用于数据的关联。可是lr_xml_get_values出现错误,如下的红色字体不知道问题出现在哪里,请大家帮忙,谢谢!
代码片段:
// 注册函数,用于将服务器回包的body部分保存下来
web_reg_save_param("xmlcontent", "LB=", "RB=", "Search=BODY", LAST);
//向服务器提交post,(使用的是xml格式)
web_custom_request("counter**_2",
"URL=http://loanoriginationqa:8080/lo-web/service/counter**/?_method=PUT&uniqueId=Tue%20Aug%2010%2014:05:42%20GMT+0800%202010",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://loanoriginationqa:8080/lo-web/flex/main.swf",
"Snapshot=t14.inf",
"Mode=HTTP",
"EncType=text/xml",
"Body=<counter**>\n<entityGroup>\n <groupId>181</groupId>\n <groupName>LO_QA</groupName>\n</entityGroup>\n<countryOfIncorporation>\n <code>AF</code>\n <name>Afghanistan</name>\n</countryOfIncorporation>\n<description>Created By Yang</description>\n<mailingCity>TestCity</mailingCity>\n<mailingZipCode>110006</mailingZipCode>\n<industry>\n <code>25401010</code>\n <description>Advertising</description>\n</industry>\n<type>\n <code>ASS</code>\n <description"
">Insurance</description>\n</type>\n<status>New</status>\n<mailingState>TestCity</mailingState>\n<cifNumber>1111</cifNumber>\n<businessRegistrationNo>000002</businessRegistrationNo>\n<withBankSince>08-01-2012</withBankSince>\n<relationship/>\n<mailingCountry>\n <code>CN</code>\n <name>China</name>\n</mailingCountry>\n<shortName>company_2</shortName>\n<longName>company</longName>\n<contacts/>\n<mailingAddress1>No details</mailingAddress1>\n</counter**>",
LAST);
lr_output_message(lr_eval_string("{xmlcontent}"));//通过打印的数据可以看出,xmlcontent正确的保存了服务器端返回的数据
lr_xml_get_values("XML={xmlcontent}", "ValueParam=Counter**ID", "Query=/counter**/code");//这步会出现错误提示:Error: C interpreter run time error: Action.c (334):Error -- memory violation : Exception ACCESS_VIOLATION received
lr_output_message(lr_eval_string("Query result = {Counter**ID}"));//由于上步的错误,没运行到此步骤就推出了
服务器端和客户端交互的数据格式:
客户端提交:
<counter**>
<mailingState>TestCity</mailingState>
<cifNumber>1111</cifNumber>
<businessRegistrationNo>000003</businessRegistrationNo>
<relationship/>
<type>
<code>ASS</code>
<description>Insurance</description>
</type>
<mailingCountry>
<code>AF</code>
<name>Afghanistan</name>
</mailingCountry>
<status>New</status>
<contacts/>
<mailingAddress1>No details</mailingAddress1>
<mailingZipCode>110006</mailingZipCode>
<entityGroup>
<groupId>181</groupId>
<groupName>LO_QA</groupName>
</entityGroup>
<shortName>company_3</shortName>
<longName>company</longName>
<countryOfIncorporation>
<code>AF</code>
<name>Afghanistan</name>
</countryOfIncorporation>
<mailingCity>TestCity</mailingCity>
<industry>
<code>25401010</code>
<description>Advertising</description>
</industry>
<description>Created By Yang</description>
</counter**>
服务器端返回:
<counter**>
<code>764</code>
<shortName>company_3</shortName>
<longName>company</longName>
<description>Created By Yang</description>
<type>
<code>ASS</code>
<description>Insurance</description>
</type>
<cifNumber>1111</cifNumber>
<businessRegistrationNo>000003</businessRegistrationNo>
<countryOfIncorporation>
<code>AF</code>
<name>Afghanistan</name>
</countryOfIncorporation>
<industry>
<code>25401010</code>
<description>Advertising</description>
</industry>
<status>New</status>
<mailingAddress1>No details</mailingAddress1>
<mailingCity>TestCity</mailingCity>
<mailingZipCode>110006</mailingZipCode>
<mailingState>TestCity</mailingState>
<mailingCountry>
<code>AF</code>
<name>Afghanistan</name>
</mailingCountry>
<contacts/>
<relationship/>
<entityGroup>
<groupId>181</groupId>
<groupName>LO_QA</groupName>
</entityGroup>
</counter**>
把出错那部分单列出来,顺便顶顶
lr_xml_get_values("XML={xmlcontent}", "ValueParam=Counter**ID", "Query=/colunter**/code");Error: C interpreter run time error: Action.c (334):Error -- memory violation : Exception ACCESS_VIOLATION received.
出现敏感字,竟然被××了
lr_xml_get_values("XML={xmlcontent}", "ValueParam=CounterpartID", "Query=/colunterpart/code");Error: C interpreter run time error: Action.c (334):Error -- memory violation : Exception ACCESS_VIOLATION received. 把xml里 ** 给弄掉。。。
回复 4# 的帖子
这个是用了**上的一个英文词语,被屏蔽了,呵呵;程序中是没问题的:) lr_xml_get_values("XML={xmlcontent}", "ValueParam=CounterpartID", "Query=//code",LAST);试了 这样是可以的,如果你这句会报错的话,那就。。。
改晚了,刚想说,呵呵
[ 本帖最后由 skyzhu 于 2010-8-10 17:41 编辑 ]
谢谢大家,问题解决了
我上网查了一下Exception ACCESS_VIOLATION
Web (HTTP/HTML) scripts in LoadRunner are implemented using C programming language. And like always with C, you should remember about some basics. One of them is that few string handling function can return NULL value instead of correct pointer which will definitely lead to exception like the one below:
1.Action.c(7): Error: C interpreter run time error: Action.c (7):Error — memory violation : Exception ACCESS_VIOLATION received.
Basically if you see message like this, it is not any internal LoadRunner error. It means that you made a mistake in your script and you need to fix it.
他说 Exception ACCESS_VIOLATION received不是LoadRunner内部的错误,而是C代码的函数写的有问题;所以我反复对比了一下,发现是问题是
lr_xml_get_values("XML={xmlcontent}", "ValueParam=CounterID", "Query=/counter/code");
改成
lr_xml_get_values("XML={xmlcontent}", "ValueParam=CounterID", "Query=/counter/code", LAST);
就好了。
再次感谢大家的关注!!! 额,这个问题。。。还好解决了,否则大家要纠结很久,代码写错害死人 云老师介绍socket时候参数写反了,耽误好多时间哦:lol :Q 后面我才发现,郁闷啊 汗,一个非常简单的语法错误,不过这类问题,自己看的话,还真难发现
页:
[1]