我需要拿起值
'myvalue的'
在这个肥皂反应中:
</something>
<id>myvalue</id>
使用LoadRunners lr_xml_get_values()函数我想从响应中获取值'myvalue',我认为这样可行:
lr_xml_get_values("XML={response}", ValueParam=mv", "Query=//something/id/id", LAST);
但是LoadRunner无法找到该值。
我想这与/ in有关。
那么如何在LoadRunner中指定(正确)这个xpath?
这是完整的xml响应
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://gaylord.com/service/service/person/v1/hore/getmeinformationResponse</wsa:Action>
<wsa:RelatesTo>uuid:3de7a201-1544-4bfc-8445-c240353d6c38</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<ns2:getmeinformationResponse xmlns:ns2="http://gaylord.com/service/service/person/v1/">
<response>
<person xsi:type="ns4:Bruker" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://gaylord.com/service/service/person/v1/information">
<bankaccount endretAv="2701783" endringstidspunkt="2013-08-02T00:00:00.000+02:00" xsi:type="ns4:bankaccountswege">
<bankaccount>
<bankaccountnummer>7645786655</bankaccountnummer>
</bankaccount>
</bankaccount>
<adress>
<adresstome xsi:type="ns4:Gateadresse">
<count>swe</count>
<pust>1361</pust>
<fytti>0219</fytti>
<street>roadtohell</street>
<idiot>92</idiot>
<letter>B</letter>
</adresstome>
</adress>
<civil>
<civil>GIFT</civil>
</civil>
<ghy endringstidspunkt="2002-05-22T00:00:00.000+02:00">
<land>swe</land>
</ghy>
<harFraRolleI>
<harSammeBosted>true</harSammeBosted>
<tilRolle>BARN</tilRolle>
<tilPerson>
<ident>
<ident>34785699875</ident>
<type>fnr</type>
</ident>
<personnavn endretAv="AJOURHD" endringstidspunkt="2009-12-01T00:00:00.000+01:00">
<aftermath>gaylord</aftermath>
<forename>miss</forename>
<mid>heys</mid>
<sammensattNavn>gaylord miss BRÅTEN</sammensattNavn>
</personnavn>
</tilPerson>
</harFraRolleI>
<harFraRolleI>
<harSammeBosted>true</harSammeBosted>
<tilRolle>EKTE</tilRolle>
<tilPerson>
<ident>
<ident>34785699875</ident>
<type>fnr</type>
</ident>
<personnavn endretAv="AJOURHD" endringstidspunkt="2011-08-25T00:00:00.000+02:00">
<aftermath>gaylord</aftermath>
<forename>MARIANNE</forename>
<mid>heys</mid>
<sammensattNavn>gaylord MARIANNE BRÅTEN</sammensattNavn>
</personnavn>
</tilPerson>
</harFraRolleI>
<harFraRolleI>
<harSammeBosted>false</harSammeBosted>
<tilRolle>FARA</tilRolle>
<tilPerson>
<ident>
<ident>34785699875</ident>
<type>fnr</type>
</ident>
<personnavn endringstidspunkt="2002-05-22T00:00:00.000+02:00">
<aftermath>gaylord</aftermath>
<forename>anton JÔRGEN</forename>
<sammensattNavn>gaylord anton JØRGEN</sammensattNavn>
</personnavn>
</tilPerson>
</harFraRolleI>
<harFraRolleI>
<harSammeBosted>false</harSammeBosted>
<tilRolle>MORA</tilRolle>
<tilPerson>
<ident>
<ident>34785699875</ident>
<type>fnr</type>
</ident>
<personnavn endringstidspunkt="2002-05-22T00:00:00.000+02:00">
<aftermath>gorm</aftermath>
<forename>fru ELISABETH</forename>
<sammensattNavn>gorm fru ELISABETH</sammensattNavn>
</personnavn>
</tilPerson>
</harFraRolleI>
<ident>
<ident>34785699875</ident>
<type>fnr</type>
</ident>
<kjoenn>
<kjoenn>M</kjoenn>
</kjoenn>
<personnavn endringstidspunkt="2002-05-22T00:00:00.000+02:00">
<aftermath>gaylord</aftermath>
<forename>myron</forename>
<mid>gorm</mid>
<sammensattNavn>gaylord myron gorm</sammensattNavn>
</personnavn>
<personstatus endringstidspunkt="2002-05-22T00:00:00.000+02:00">
<personstatus>BOSA</personstatus>
</personstatus>
<foedselsdato>
<foedselsdato>1978-01-27+01:00</foedselsdato>
</foedselsdato>
<gjeldendePostadresseType>adress</gjeldendePostadresseType>
<harAnsvarligEnhet>
<enhet>
<organisasjonselementID>0219</organisasjonselementID>
</enhet>
</harAnsvarligEnhet>
</person>
</response>
</ns2:getmeinformationResponse>
</soapenv:Body>
</soapenv:Envelope>
答案 0 :(得分:1)
在您提供的soap响应中,<id>
不是</something>
的子元素,因为它位于结束标记之后(如果<id>
位于<something></something>
之内,那么你将更接近正确的查询)。另外,为什么在查询中有两次ìd
?如果我没有完全弄错,Query=//id
就足以在该回复中获取myvalue
。
答案 1 :(得分:0)
请复制以下代码粘贴到Web服务的操作中并运行它。
我从您提供的SOAP中捕获帐号,它将帮助您理解和捕获任何值。
char * str =&#34; http://schemas.xmlsoap.org/soap/envelope/ \&#34;&gt;&#34; &#34; HTTP://www.w3.org/2005/08/addressing \&#34;&GT;&#34; &#34; http://gaylord.com/service/service/person/v1/hore/getmeinformationResponse&#34; &#34; UUID:3de7a201-1544-4bfc-8445-c240353d6c38&#34; &#34;&#34; &#34;&#34; &#34; HTTP://gaylord.com/service/service/person/v1/ \&#34;&GT;&#34; &#34;&#34; &#34; HTTP://www.w3.org/2001/XMLSchema-instance \&#34;的xmlns:NS4 = \&#34; HTTP://gaylord.com/service/service/person/v1/information \&#34;&GT;&#34; &#34;&#34; &#34;&#34; &#34; 7645786655&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34; SWE&#34; &#34; 1361&#34; &#34; 0219&#34; &#34; roadtohell&#34; &#34; 92&#34; &#34; B&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34; GIFT&#34; &#34;&#34; &#34;&#34; &#34; SWE&#34; &#34;&#34; &#34;&#34; &#34;真&#34; &#34;谷仓&#34; &#34;&#34; &#34;&#34; &#34; 34785699875&#34; &#34; FNR&#34; &#34;&#34; &#34;&#34; &#34;盖洛德&#34; &#34;未命中&#34; &#34; heys&#34; &#34; gaylord miss BRTEN&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;真&#34; &#34; EKTE&#34; &#34;&#34; &#34;&#34; &#34; 34785699875&#34; &#34; FNR&#34; &#34;&#34; &#34;&#34; &#34;盖洛德&#34; &#34; MARIANNE&#34; &#34; heys&#34; &#34; gaylord MARIANNE BRTEN&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;假&#34; &#34; FARA&#34; &#34;&#34; &#34;&#34; &#34; 34785699875&#34; &#34; FNR&#34; &#34;&#34; &#34;&#34; &#34;盖洛德&#34; &#34; anton JRGEN&#34; &#34; gaylord anton JRGEN&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;假&#34; &#34;莫拉&#34; &#34;&#34; &#34;&#34; &#34; 34785699875&#34; &#34; FNR&#34; &#34;&#34; &#34;&#34; &#34; GORM&#34; &#34; fru ELISABETH&#34; &#34; gorm fru ELISABETH&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34; 34785699875&#34; &#34; FNR&#34; &#34;&#34; &#34;&#34; &#34; M&#34; &#34;&#34; &#34;&#34; &#34;盖洛德&#34; &#34;米隆&#34; &#34; GORM&#34; &#34; gaylord myron gorm&#34; &#34;&#34; &#34;&#34; &#34; BOSA&#34; &#34;&#34; &#34;&#34; &#34; 1978年1月27日+ 01:00&#34; &#34;&#34; &#34; ADRESS&#34; &#34;&#34; &#34;&#34; &#34; 0219&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34; &#34;&#34 ;;
lr_save_string(STR,&#34;响应&#34);
lr_xml_get_values("XML={response}",
"ValueParam=OutputParam",
"Query=/Envelope/Body/getmeinformationResponse/response/person/bankaccount/bankaccount/bankaccountnummer",
LAST );