Question

I need to pick up the value

'myvalue'

in this soap response:

</something>
<id>myvalue</id>

Using LoadRunners lr_xml_get_values() function I want to get the value 'myvalue' from the response, and I thought this would work:

lr_xml_get_values("XML={response}", ValueParam=mv", "Query=//something/id/id", LAST);

But LoadRunner cannot find the value.

I guess it has to do With the / in .

So how do I specify (correctly) this xpath in LoadRunner?

Here is the complete xml response

<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>
Was it helpful?

Solution

In the soap response you've provided, <id> is not a subelement of </something>, as it comes after the end-tag (if <id> was within <something></something>, then you'd be closer to a correct query). Also, why do you have ìd twice in your Query? If I'm not totally mistaken, Query=//id would be sufficient to fetch myvalue in that response.

OTHER TIPS

Please copy paste the below code in action of the web service and run it.

i capture the account number from the SOAP which you have provided and it will help you to understand and capture any values.

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" "" "" "" "" "swe" "1361" "0219" "roadtohell" "92" "B" "" "" "" "GIFT" "" "" "swe" "" "" "true" "BARN" "" "" "34785699875" "fnr" "" "" "gaylord" "miss" "heys" "gaylord miss BRTEN" "" "" "" "" "true" "EKTE" "" "" "34785699875" "fnr" "" "" "gaylord" "MARIANNE" "heys" "gaylord MARIANNE BRTEN" "" "" "" "" "false" "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" "" "adress" "" "" "0219" "" "" "" "" "" "" "";

lr_save_string(str,"response");

 lr_xml_get_values("XML={response}",
      "ValueParam=OutputParam",
      "Query=/Envelope/Body/getmeinformationResponse/response/person/bankaccount/bankaccount/bankaccountnummer",
      LAST );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top