Given the following XML:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetMsisdnResponse xmlns="http://my.domain.com/">
<GetMsisdnResult>
<RedirectUrl>http://my.domain.com/cw/DoIdentification.do2?sessionid=71de6551fc13e6625194</RedirectUrl>
</GetMsisdnResult>
</GetMsisdnResponse>
</soap:Body>
</soap:Envelope>
I am trying to access the RedirectUrl element using XPath in VBScript:
set xml = CreateObject("MSXML2.DOMDocument")
xml.async = false
xml.validateOnParse = false
xml.resolveExternals = false
xml.setProperty "SelectionLanguage", "XPath"
xml.setProperty "SelectionNamespaces", "xmlns:s='http://my.domain.com/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"
err.clear
on error resume next
xml.loadXML (xmlhttp.responseText)
if (err.number = 0) then
redirectUrl = xml.selectSingleNode("/soap:Envelope/soap:Body/s:GetMsisdnResponse/s:GetMsisdnResult/s:RedirectUrl").text
end if
but it is failing to find the RedirectUrl node, therefore is nothing when I try to get the .text property. What am I doing wrong