Venushree Patel
Venushree Patel

Reputation: 299

Xpath Post Processor : extract node content from a SOAP response

I have a soap response of this form

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:Responseto xmlns:ns2="http://xyz.company.com/">
         <return>
            <objectContent xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">/path/to/file.txt</objectContent>
            <objectType>FILEPATH</objectType>
            <rid>111</rid>
            <sid>2</sid>
         </return>
      </ns2:Responseto>
   </S:Body>
</S:Envelope>

I wish to extract the object content in jmeter in order to feed to an xpath assertion.

Can anyone suggest how to do this?

I tried //return/objectType but then the DebugSampler shows me that the value of my variable is blank.

Upvotes: 2

Views: 4575

Answers (1)

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34566

  • Put you XPath Extractor as a child of the Request that has the response you mention.

  • Configure the extractor like this:

    "Main Sample" Only
    "Use Namespaces" checked
    "Ignore Whitespaces" checked
    "Return entire XPath fragment instead of text content" Unchecked
    "XPath query" : //return/objectType
    

I tested it it works.

Upvotes: 2

Related Questions