2012-10-01 60 views
2

内容予有这种形式Xpath的后处理器:提取节点从SOAP响应

<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断言的SOAP响应。

任何人都可以建议如何做到这一点?

我试过//return/objectType但是然后DebugSampler显示我的变量值是空的。

回答

1
  • 将XPath提取器作为具有您提及的响应的请求的子项。

  • 配置这样的提取:

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

我测试了它的工作原理。