频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

Using SOAP from inside ASP,maybe helpful for you

来源: 作者: 出处:巧巧读书 2006-09-29 进入讨论组
    default.asp
------------------------------------------------------------------------
<%@ Language=VBScript %>
<%Option Explicit%>
<!-- #include file="i_soapcall.asp" -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
Dim ASPNETResources
If len( Application("ASPNETResourceList") )>0 then 'we have our latest resources

REM -- check to see if they expired
If DateDiff("h",Now(),Application("ASPNETResourcesUpdated")) > Application("ASPNETExpires") Then
REM -- we need to update the latest resurces
ASPNETResources = GetASPNetResources()
Application.Lock
Application("ASPNETResourcesUpdated")=Now()
Application("ASPNETResourceList")=ASPNETResources
Application.UnLock
End if 'datediff...

Else 'for some reason the application level variable is empty, fill it.
ASPNETResources = GetASPNetResources()
Application.Lock
Application("ASPNETResourcesUpdated")=Now()
Application("ASPNETResourceList")=ASPNETResources
Application.UnLock

End if 'len(..

Response.Write Application("ASPNETResourceList")

%>
<P>&nbsp;</P>

</BODY>
</HTML>

global.asa
------------------------------------------------------------------------
<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart
Dim ASPNETResources

ASPNETResources = GetASPNetResources()
Application("ASPNETExpires") = 12 'set the content to expire in 12 hours.
If Len(ASPNETResources) >0 then 'populate the application level variables
Application.Lock

Application("ASPNETResourcesUpdated")=Now()
Application("ASPNETResourceList")=ASPNETResources
Application.UnLock
End if

End Sub
</script>
<!-- #include file="i_soapcall.asp" -->

i_soapcall.asp
-----------------------------------------------------------------------
<script language="vbscript" runat="server">
Function GetASPNetResources()
Dim returnString
Dim myXML
Dim SoapRequest
Dim SoapURL

Set SoapRequest = Server.CreateObject("MSXML2.XMLHTTP")
Set myXML =Server.CreateObject("MSXML.DOMDocument")

myXML.Async=False
SoapURL = "http://64.85.12.73/WebSvc/whatsnew123apx_ds.asmx/GetNew123aspXResources?"
SoapRequest.Open "GET",SoapURL , False
SoapRequest.Send()

if Not myXML.load(SoapRequest.responseXML) then 'an Error loading XML
returnString = ""
Else 'parse the XML

Dim nodesURL
Dim nodesName
Dim nodesDateUpdated
Dim nodesDomain
Dim NumOfNodes
Dim ResourceList
Dim i

REM -- The XML Nodes are CASE SENS99vIVVE!
Set nodesURL=myXML.documentElement.selectNodes("//URL")
Set nodesName=myXML.documentElement.selectNodes("//Name")

REM -- uncomment the following lines if we want to access the DataUpdated and the Domain Nodes
REM --Set nodesDateUpdated = myXML.documentElement.selectNodes("//DateUpdated")
REM --Set nodesDomain = myXML.documentElement.selectNodes("//Domain")

REM -- the number of nodes in the list
NumOfNodes = nodesURL.Length
ResourceList = "<font face=verdana size=2>Latest ASP.NET Resources</font><ul>"

For i = 0 to NumOfNodes -1
ResourceList = ResourceList & "<li><a href=" & nodesURL(i).text & "><font face=verdana size=2>" & nodesName(i).text & "</font></a></li>"
next

ResourceList =ResourceList & "</ul>"

returnString = ResourceList

Set nodesURL = Nothing
Set nodesName = Nothing
End If

Set SoapRequest = Nothing
Set myXML = Nothing


GetASPNetResources = returnString
End Function
</script>

 图 文 结 合:http://www.qqread.com/xml-soap/h228911.html进入讨论组讨论。
收藏此文】【 】【打印】【关闭
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
巧巧读书宗旨
相关专题
最新论坛文章
站内各频道最新更新文档
站内最新制作专题
热门关键字导读
Photoshop教 程照片处理 照片制作 PS快捷键 抠图
计 算 机 故 障XP系统修复
艺 术 与 设 计设计 流媒体 设计欣赏 边框
计 算 机 安 全ARP
站内频道文章精选
巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章