调用WebService 方法返回xml格式数据,可以返回值但是获取节点的时候出错,求大神解答
if request("action")="save" then
dim url,soaprequest,retvalue
url = "http://192.168.1.104:8088/MServer.asmx/GetMServerNo"
set xmlhttp = server.createobject("msxml2.xmlhttp")
xmlhttp.open "post",url,false
xmlhttp.setrequestheader "content-type", "application/x-www-form-urlencoded"
xmlhttp.setrequestheader "host",host
xmlhttp.setrequestheader "content-length",len(soaprequest)
xmlhttp.send(soaprequest)
if xmlhttp.status = 200 then
set xmldoc = server.createobject("Msxml2.DOMDocument")
xmldoc.load(xmlhttp.responsexml)
Response.Write xmldoc.xml
‘这里输出Xml文本是正常的,获取节点的时候出错
xmldoc.getElementsByTagName("MServerno")
else
Response.Write xmlhttp.status&" "
Response.Write xmlhttp.StatusText
end if
set xmlhttp = nothing
end if
调用WebService方法返回Xml格式的值如下:
<?xml version="1.0"?> <Student xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <MServerno>10006789</MServerno> <TransferKey>123456</TransferKey> <SupersecretKey>888888</SupersecretKey> </Student>
if request("action")="save" then
dim url,soaprequest,retvalue
url = "http://192.168.1.104:8088/MServer.asmx/GetMServerNo"
set xmlhttp = server.createobject("msxml2.xmlhttp")
xmlhttp.open "post",url,false
xmlhttp.setrequestheader "content-type", "application/x-www-form-urlencoded"
xmlhttp.setrequestheader "host",host
xmlhttp.setrequestheader "content-length",len(soaprequest)
xmlhttp.send(soaprequest)
if xmlhttp.status = 200 then
set xmldoc = server.createobject("Msxml2.DOMDocument")
xmldoc.load(xmlhttp.responsexml)
Response.Write xmldoc.xml
‘这里输出Xml文本是正常的,获取节点的时候出错
xmldoc.getElementsByTagName("MServerno")
else
Response.Write xmlhttp.status&" "
Response.Write xmlhttp.StatusText
end if
set xmlhttp = nothing
end if
调用WebService方法返回Xml格式的值如下:
<?xml version="1.0"?> <Student xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <MServerno>10006789</MServerno> <TransferKey>123456</TransferKey> <SupersecretKey>888888</SupersecretKey> </Student>