2017-03-22 1 views
0

누군가가 XPath를 사용하여 SOAP 응답을 트래버스하는 요구 사항을 해결할 수 있는지 궁금합니다.네임 스페이스를 고려한 SOAP 요청에 대한 Xpath

<?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'] 
+0

당신의 XPath의 문제는 무엇을 ? 그것은 작동 했어야합니다 : http://www.xpathtester.com/xpath/db1e368fd8865035f4523a8dd54f0d13 – har07

+0

아니면 내부 텍스트를 얻으려면 해당 XPath의 끝에'/ text()'를 추가해야합니까? – har07

+0

흠. 아마도 내가 사용하고있는 도구는 잘못된 결과를 제공합니다. http://codebeautify.org/Xpath-Tester – Steerpike

답변

0
//header/status/text() 

위의 XPath로 시도하십시오하면, 그것은 "성공"을 줄 것이다

관련 문제