2

我有这个表格的肥皂回复

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

我希望提取 jmeter 中的对象内容以提供给 xpath 断言。

谁能建议如何做到这一点?

我试过//return/objectType了,但 DebugSampler 显示我的变量的值为空白。

4

1 回答 1

2
  • 将您的 XPath Extractor 作为具有您提到的响应的请求的子项。

  • 像这样配置提取器:

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

我测试了它的工作原理。

于 2012-10-01T20:38:41.310 回答