2016-07-24 6 views
0

私はこのsoapレスポンスを持っていて、platformMessageというタグの値を取得する必要がありますが、xpathクエリを書きましたが、jmeterのログファイルをチェックすると "Prefix must NS2" 、HERESにHERESにXPathクエリsoap response jmeterから値を取得する方法

/S:Envelope[@xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"]/S:Body/ns2:activateProductResponse[@xmlns:ns2="http://ws.business.api.fulfillmentengine.com/"]/return/platformMessage 

@xmlnsを使用してXML

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <ns2:activateProductResponse xmlns:ns2="http://ws.business.api.fulfillmentengine.millicom.com/"> 
     <return> 
      <platformCode>1</platformCode> 
      <platformMessage>Fail operation.El set-top box ya existe. Code Response:|22098: 22098: 1</platformMessage> 
      <responseCode>13</responseCode> 
      <responseMessage>Error executing action in platforn</responseMessage> 
      <UUID>3cb49b29-513e-11e6-b5db-005056807f0c</UUID> 
      <platformName>INTRAWAY</platformName> 
     </return> 
     </ns2:activateProductResponse> 
    </S:Body> 
</S:Envelope> 

答えて

0

:名前空間に解決の出演にもかかわらず、名前空間が同じではありませんので、XPathの中NS2が有効ではありません属性。

/S:Envelope/S:Body/ns2:activateProductResponse/return/platformMessage 

をそれとも、汚い(と遅い)回避策をしたい場合、あなたはそうのようなノード名を参照できます:

あなたは「使用の名前空間」を有効にした場合、次のXPathは動作するはず

/*[local-name()='Envelope']/*[local-name()='Body']/*/[local-name()='activateProductResponse]/return/platformMessage 
0

お読みください。

  • https://jmeter.apache.org/usermanual/component_reference.html#XPath_Assertionはに特に注意を払います prefix1 =完全な名前空間1 prefix2 =完全な名前空間2 ... このファイルは、jmeter.propertiesファイル内でプロを使用して参照していますperty:

    • xpath.namespace.configこのプロパティのjmeter.propertiesで

    ルック、すべてがはっきり

    を説明されています
  • 関連する問題