1
<soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:body>
<acceptleadresponse xmlns="http://tempuri.org/WhiteBox/Lead">
<acceptleadresult>
<purchase>false</purchase>
<rejectreason>Duplicate Lead</rejectreason>
<tier>0</tier>
<starttime>2013-09-05T18:15:32.1757337-05:00</starttime>
<endtime>2013-09-05T18:15:32.2693339-05:00</endtime>
<redirect>https://www1.paydaymate.com.au/Account/Sorry</redirect>
</acceptleadresult>
</acceptleadresponse>
</soap:body>
</soap:envelope>
두 개의 노드를 가져 와서 리디렉션하고 구입해야합니다. 그러나 모든 값은 괜찮을 것입니다 (foreach). 나는 네임 스페이스 작업을 시도하지만, 말 그대로 간단한 :SOAP 응답 - 네임 스페이스 처리
$xml = simplexml_load_string($xml);
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$result = $xml->xpath('/soap:envelope/soap:body');
$ar = $result[0];
$result = $ar->acceptleadresponse->acceptleadresult;
print_r($result);
$ 결과는 지금 포함됩니다 ... SimpleXML을가로 이렇게 어디서나
$xml = simplexml_load_string($response['response'], NULL, NULL, "http://schemas.xmlsoap.org/soap/envelope/");
//print_r($xml);
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
foreach($xml->xpath('//acceptleadresponse') as $header){
var_export($header->xpath('//acceptleadresult'));
}
가장 확실하게 'tempuri'네임 스페이스를 등록해야합니다. 접두사없이 기본 네임 스페이스로 등록 할 수 있는지 여부는 알 수 없습니다. 할 수 없다면 기본 네임 스페이스 (비누 응답에 접두어가 없음)의 요소를 참조 할 때 xpath 표현식에 사용하는 Choice 접두어로 등록하십시오. – collapsar