动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   Xml → 阅读文章

 Using SOAP from inside ASP,maybe helpful for you

作者来源: 
阅读 数 640 人次 , 2006-3-29 3:14:00 

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 SENSITIVVE!
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>

 本文Tagssoap  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:SQL Server XML 和 Web 应用体系结构
· 下一篇:利用ASP生成XML文档
· 不用编程,得到一个用户QQ在线状态
· XML技术上传文件4
· XML数据库中几个容易混淆的概念1
· XML 使用NodeList对象
· XML技术上传文件2


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077