Created
May 10, 2012 06:55
-
-
Save hiscaler/2651534 to your computer and use it in GitHub Desktop.
ASP 操作 Web Services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim objDoc, objSOAPClient | |
set objDoc = Server.CreateObject("Msxml2.DomDocument.4.0") | |
set objSOAPClient = Server.CreateObject("MSSOAP.SoapClient30") | |
sPath = "http://192.168.0.1/services/webService?wsdl" | |
objSOAPClient.ClientProperty("ServerHTTPRequest") = true | |
objSOAPClient.MSSoapInit(sPath) | |
if err.number <> 0 then | |
Response.Write("<script type=""text/javascript"">alert('Web Services 调用失败。');location.href='?';</script>") | |
else | |
dim token, xmlDoc | |
'Get the token | |
password = md5(password) | |
token = objSOAPClient.getLoginInfo(username, password) | |
'Get the XML. | |
set xmlDoc = Server.CreateObject( "MSXML2.DomDocument" ) | |
xmlDoc.loadxml(token) | |
Dim isLogined:isLogined = xmlDoc.getElementsByTagName("loginInfo/isSucess").item(0).text | |
If (CInt(isLogined) = 0) Then | |
Response.Write("<script type=""text/javascript"">alert('" & xmlDoc.getElementsByTagName("loginInfo/sMessage").item(0).text & "');location.href='?';</script>") | |
Else | |
Dim x_userid, x_username, x_sum_points, x_use_points | |
x_userid = xmlDoc.getElementsByTagName("loginInfo/memInfo/id").item(0).text | |
x_username = xmlDoc.getElementsByTagName("loginInfo/memInfo/name").item(0).text | |
x_sum_points = xmlDoc.getElementsByTagName("loginInfo/cardInfos/cardInfo/sumPoints").item(0).text | |
If (UtilHelper.checkNull(x_sum_points)) Then | |
x_sum_points = 0 | |
End If | |
x_use_points = xmlDoc.getElementsByTagName("loginInfo/cardInfos/cardInfo/usePoints").item(0).text | |
If (UtilHelper.checkNull(x_use_points)) Then | |
x_use_points = 0 | |
End If | |
Session("userid") = x_userid | |
Session("username") = x_username | |
Session("sum_points") = x_sum_points | |
Session("use_points") = x_use_points | |
Response.Redirect("userinfor.asp") | |
End If | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment