2012-10-01 54 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 
    

我測試了它的工作原理。