Bilow Yuriy
Bilow Yuriy

Reputation: 1319

Get data from xml response in Jmeter

                 Hi Everyone!

I would like to get status from this response from Jmeter.How can i create regexp for that? I just want to get 'vacant' from response

    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns5:GetRandomMSISDNListResponse xmlns:ns2="http://www.trump.com/products/common/core" xmlns:ns3="http://www.trump.com/products/common/rr" xmlns:ns4="http://www.yota224.com/vux/domains/common/core" xmlns:ns5="http://www.yota224.com/vux/services/inventory">
      <ns2:extension>
        <ns2:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:RequestContextType">
          <ns2:correlationId>8f7ce7e1-31ae-40fe-82ba-4d59f634e599</ns2:correlationId>
        </ns2:item>
      </ns2:extension>
      <msisdnList>
        <homeRegion>1078</homeRegion>
        <msisdn>9992146221</msisdn>
        <status>vacant</status>
      </msisdnList>
    </ns5:GetRandomMSISDNListResponse>
  </soap:Body>
</soap:Envelope>

enter image description here

Upvotes: 0

Views: 303

Answers (1)

Dmitri T
Dmitri T

Reputation: 168082

If you targeting to do it via Regular Expressions - the relevant one would be something like:

<status>(\w+)</status>

Here is how it looks in the "RegExp Tester" mode of the View Results Tree listener

View Results Tree


Also it might be easier to use XPath Extractor which is designed for working with XML data. In that case the relevant XPath query to get the status will be as simple as:

//status

XPath Extractor Demo

Upvotes: 1

Related Questions