0

我需要拿起价值

'我的价值'

在这个肥皂回应中:

</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>
4

2 回答 2

1

在您提供的肥皂响应中,<id>不是 的子元素</something>,因为它位于结束标记之后(如果<id>在 内<something></something>,那么您将更接近正确的查询)。另外,为什么ìd您的查询中有两次?如果我没有完全弄错,Query=//id就足以获取myvalue该响应。

于 2013-08-02T07:08:31.153 回答
0

请将以下代码复制粘贴到 Web 服务的操作中并运行它。

我从您提供的 SOAP 中捕获帐号,它将帮助您理解和捕获任何值。

char * str= "http://schemas.xmlsoap.org/soap/envelope/\">" "http://www.w3.org/2005/08/addressing\">" " http://gaylord. com/service/service/person/v1/hore/getmeinformationResponse" "uuid:3de7a201-1544-4bfc-8445-c240353d6c38" "" "" "http://gaylord.com/service/service/person/v1/\">" "" "http://www.w3. org/2001/XMLSchema-instance\"xmlns:ns4=\"http://gaylord.com/service/service/person/v1/information\">""""""7645786655"""""""" ” “瑞典” “1361”“0219” “roadtohell” “92” “B” “” “” “” “礼物” “” “” “swe” “” “” “真” “BARN” “” “” “34785699875”“fnr”“”“”“gaylord”“小姐”“嘿”“gaylord BRTEN小姐”“”“”“”“”“真”“EKTE”“”“”“34785699875”“fnr”“”“”“gaylord”“MARIANNE”“嘿”“gaylord MARIANNE BRTEN”“”“”“”“”“假”“FARA”“”“”“34785699875”"fnr""""""gaylord""anton JRGEN""gaylord anton JRGEN""""""""""false""MORA""""""34785699875""fnr""""""gorm""fru ELISABETH""gorm fru ELISABETH""""""""""34785699875""fnr""""""M""""""gaylord"“myron” “gorm” “gaylord myron gorm” “” “” “BOSA” “” “” “1978-01-27+01:00” “” “地址” “” “” “0219” “” “” “ " "" """""";

lr_save_string(str,"响应");

 lr_xml_get_values("XML={response}",
      "ValueParam=OutputParam",
      "Query=/Envelope/Body/getmeinformationResponse/response/person/bankaccount/bankaccount/bankaccountnummer",
      LAST );
于 2013-08-02T14:52:40.123 回答