考虑命名空间的 SOAP 请求的 Xpath



我想知道是否有人可以帮助我了解使用 XPath 遍历 SOAP 响应以挑选数据的要求。

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
  <ns2:preferredPaymentSearch  xmlns:ns2="http://website.abc.com">
     <header>
        <issueAudit>
           <info>
              <issues>
                 <issue severity="INFO" issueId="7f32d1f1-8355-4af3-8862-6e3b66061c41" host="server.test.com/10.2.333.46" issueMessage="qqdG6jVIqIkw459wSj0ymokh" issueCode="TrackingId" timestamp="2017-03-22T09:36:40.362Z" />
                 <issue severity="INFO" issueId="220f5972-eed0-43e3-be72-cdbea1798520" host="server.test.mcom/10.2.333.46" issueMessage="server.test.com/10.2.333.46" issueCode="Host" timestamp="2017-03-22T09:36:40.362Z" />
              </issues>
           </info>
           <warnings>
              <issues />
           </warnings>
           <errors>
              <issues />
           </errors>
        </issueAudit>
        <status>SUCCESS</status>
        <ver>1.0.0-SNAPSHOT</ver>
     </header>
     <results>
        <preferredPaymentResults>
           <preferredPaymentCriterion>
              <productSupplier>
                 <ns2:actorCode>ABC</ns2:actorCode>
              </productSupplier>
              <requiredFunds amount="59.29" currency="GBP" />
           </preferredPaymentCriterion>
           <preferredPaymentOption>
              <preferredCardOption>
                 <cardForm>PHYSICAL</cardForm>
                 <cardType>VISA_CREDIT</cardType>
                 <provider>lodged</provider>
              </preferredCardOption>
           </preferredPaymentOption>
        </preferredPaymentResults>
     </results>
  </ns2:preferredPaymentSearch>

如何获取<status>标记中的数据?

我本以为以下内容会返回所需的"成功"数据:

//soap:Body/descendant::*[name()='status']
//header/status/text()

请尝试使用上面的xpath,它将给出"成功">

相关内容

  • 没有找到相关文章

最新更新