0
这是我的SOAP XML文档Body元素:尝试查询香皂:使用XPath
HTTP/1.1 200 OK
Date: Mon, 12 Mar 2012 15:42:41 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 424
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://localhost/SPFService/">
<LoginResult>
<Reply xmlns="">
<SessionID>cdfbe607-59b1-4912-ae54-2190f1b7c7dd
</SessionID>
</Reply>
</LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
现在我需要访问的SessionID元素的TextNode值。我创建了一个xpath使用:
$this->dom->loadXML($response);
$this->xpath = new \DOMXPath($this->dom);
,其中$ response是一个包含上述xml的字符串。
问题是我只能查询"/soap:Envelope"
和"/soap:Envelope/soap:Body"
。如果我尝试查询"/soap:Envelope/soap:Body/LoginResponse"
,我会收到一个空的DOMNodeList
。我如何调试这个混乱?