Θ ε
ε
λ~a > > ASP >
ASPWEBSERVICE^j
Http://myeducs.cn εQQ 10/11/04
{$ArticleTitle}'

----INDEX----
1. soap'
2. post'
3. SHOWALLNODE()
---------------------
SOAP
SOAP λ滻
POST /WebService1/UserSignOn.asmx HTTP/1.1
Host: 192.100.100.81
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/LoginByAccount"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <LoginByAccount xmlns="http://tempuri.org/">
      <username>string</username>
      <password>string</password>
    </LoginByAccount>
  </soap:Body>
</soap:Envelope>
WEBSERVICESOAP
<%
url = "http://192.100.100.81/WebService1/UserSignOn.asmx"

SoapRequest="<?xml version="&CHR(34)&"1.0"&CHR(34)&" encoding="&CHR(34)&"utf-8"&CHR(34)&"?>"& _
"<soap:Envelope xmlns:xsi="&CHR(34)&"http://www.w3.org/2001/XMLSchema-instance"&CHR(34)&" "& _
"xmlns:xsd="&CHR(34)&"http://www.w3.org/2001/XMLSchema"&CHR(34)&" "& _
"xmlns:soap="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&CHR(34)&">"& _
"<soap:Body>"& _

"<LoginByAccount xmlns="&CHR(34)&"http://tempuri.org/"&CHR(34)&">"& _
"<username>"&username&"</username>"& _
"<password>"&password&"</password>"& _
"</LoginByAccount>"& _

"</soap:Body>"& _
"</soap:Envelope>"

Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "POST",url,false
xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
xmlhttp.setRequestHeader "HOST","192.100.100.81"
xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest)
xmlhttp.setRequestHeader "SOAPAction", "http://tempuri.org/LoginByAccount" WEBSERVICE
xmlhttp.Send(SoapRequest)
XMLHTTPSOAPSOAP.

Response.Write xmlhttp.Status&&nbsp;
Response.Write xmlhttp.StatusText
Set xmlhttp = Nothing
%>
200 ok, 500 ? Connection: keep-alive .
WEBSERVICElb
SOAP
SOAP λ滻
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <LoginByAccountResponse xmlns="http://tempuri.org/">
      <LoginByAccountResult>string</LoginByAccountResult>
    </LoginByAccountResponse>
  </soap:Body>
</soap:Envelope>
SOAPSOAP,
If xmlhttp.Status = 200 Then

Set xmlDOC =server.CreateObject("MSXML.DOMDocument")
xmlDOC.load(xmlhttp.responseXML)
xmlStr = xmlDOC.xml
Set xmlDOC=nothing
xmlStr = Replace(xmlStr,"<","&lt;")
xmlStr = Replace(xmlStr,">","&gt;")
Response.write xmlStr
Else

Response.Write xmlhttp.Status&"&nbsp;"
Response.Write xmlhttp.StatusText

End if
t.
lb
If xmlhttp.Status = 200 Then

Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
xmlDOC.load(xmlhttp.responseXML)
Response.Write xmlDOC.documentElement.selectNodes("//LoginByAccountResult")(0).text LoginByAccountResult(б)
Set xmlDOC = nothing

Else

Response.Write xmlhttp.Status&"&nbsp;"
Response.Write xmlhttp.StatusText


End if

ijFUNCTION

Function showallnode(rootname,myxmlDOC)'' 2005-1-9 writed by 844
if rootname<>"" then

set nodeobj=myxmlDOC.documentElement.selectSingleNode("//"&rootname&"")''
nodeAttributelen=myxmlDOC.documentElement.selectSingleNode("//"&rootname&"").attributes.length''

returnstring=returnstring&"<BR>"&rootname

if nodeobj.text<>"" then
returnstring=returnstring&"<BR>i("&nodeobj.text&")"
end if

returnstring=returnstring&"<BR>{<BR>"

if nodeAttributelen<>0 then
returnstring=returnstring&"<BR>&nbsp; "&nodeAttributelen&" ,"
end if

for i=0 to nodeAttributelen-1
returnstring=returnstring&"<li>"&nodeobj.attributes(i).Name&":&nbsp;"&nodeobj.getAttribute(nodeobj.attributes(i).Name)&" </li>"
next

if nodeobj.childNodes.Length<>0 then
if nodeobj.hasChildNodes() and lcase(nodeobj.childNodes.item(0).nodeName)<>"#text"  then''
set childnodeobj=nodeobj.childNodes
childnodelen=nodeobj.childNodes.Length
returnstring=returnstring&"<BR><BR> "&childnodelen&" ;<BR>: "
for i=0 to childnodelen-1
returnstring=returnstring&"<li>"&childnodeobj.item(i).nodeName&"</li>"
next
end if
end if

returnstring=returnstring&"<BR>}<BR>"
response.write returnstring
set nodeobj=nothing
end if
End Function
~a
If xmlhttp.Status = 200 Then

Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
xmlDOC.load(xmlhttp.responseXML)
showallnode "LoginByAccountResponse",xmlDOCSHOWALLNODE
Set xmlDOC = nothing

Else

Response.Write xmlhttp.Status&"&nbsp;"
Response.Write xmlhttp.StatusText

End if

POST
HTTP POST
HTTP POST λ滻
POST /WebService1/UserSignOn.asmx/LoginByAccount HTTP/1.1
Host: 192.100.100.81
Content-Type: application/x-www-form-urlencoded
Content-Length: length

username=string&password=string
POST:
<%
url = "http://192.100.100.81/WebService1/UserSignOn.asmx/LoginByAccount"

SoapRequest="username="&username&"&password="&password

Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "POST",url,false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "HOST","192.100.100.81"
xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest)

xmlhttp.Send(SoapRequest)
XMLHTTPHTTP POSTPOST.

Response.Write xmlhttp.Status&&nbsp;
Response.Write xmlhttp.StatusText
Set xmlhttp = Nothing
%>
200 ok, 500 ? Connection: keep-alive .
WEBSERVICElb
HTTP POST
HTTP POST λ滻
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="stringhttp://tempuri.org/">string</string>



If xmlhttp.Status = 200 Then

Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
xmlDOC.load(xmlhttp.responseXML)
showallnode "string",xmlDOC''SHOWALLNODE
Set xmlDOC = nothing

Else

Response.Write xmlhttp.Status&"&nbsp;"
Response.Write xmlhttp.StatusText

End if


ASPXMLHTTPSOAPWEBSERVICEkASP′~oи~okεmailto:lyq8442002@msn.com .′HTTP GETk'LHTTP POSTkоPOSTk'POSTSOAP TOOLKIT^uк汾---

,,

а

  •  ASPε
  •  ^J
  •  ASP'
  •  80004005
  •  
  •  AspZ8
  •  ASP
  •  
  •  ASP壬
  •  asp 1/4
  •  asp19
  •  οASP
  •  SQL
  •  Щ~o
  •  ASP~o^J
  •  ASP
  •  ASP
  •  
  • | | | | | | g | | | | | | |
    QQ:3710167 3710167@qq.com [Myeducs.cn] k
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    ICP09003080