WEB客户端用ASP实现WEB服务的小例
来源:互联网 发布:防sql注入是什么意思 编辑:程序博客网 时间:2024/06/06 05:33
The following snippet demonstrate how to use ASP to invoke a web service from remote server:
<%
Set objHTTP = Server.CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =Server.CreateObject("MSXML.DOMDocument")
'The following line indicate the WebService we will use.
' It takes 2 parameters as input and output their sum,i.e.
'a simple addition online caculator.
strWebserviceURL = "http://localhost/WebService/Service1.asmx/Add"
'setup parameters and their values
strRequest = "a=15&b=26"
objHTTP.Open "POST", strWebserviceURL, False
'Setup Content-Type
objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send(strRequest)
bOK = xmlDOC.load(objHTTP.responseXML)
'Check http status
if objHTTP.Status=200 then
xmlStr = xmlDOC.xml
xmlStr = Replace(xmlStr,"<","<",1,-1,1)
xmlStr = Replace(xmlStr,">",">",1,-1,1)
Response.Write xmlStr
else
Response.Write objHTTP.Statu & "<br>"
Response.Write objHTTP.StatusText
end if
%>
<%
Set objHTTP = Server.CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =Server.CreateObject("MSXML.DOMDocument")
'The following line indicate the WebService we will use.
' It takes 2 parameters as input and output their sum,i.e.
'a simple addition online caculator.
strWebserviceURL = "http://localhost/WebService/Service1.asmx/Add"
'setup parameters and their values
strRequest = "a=15&b=26"
objHTTP.Open "POST", strWebserviceURL, False
'Setup Content-Type
objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send(strRequest)
bOK = xmlDOC.load(objHTTP.responseXML)
'Check http status
if objHTTP.Status=200 then
xmlStr = xmlDOC.xml
xmlStr = Replace(xmlStr,"<","<",1,-1,1)
xmlStr = Replace(xmlStr,">",">",1,-1,1)
Response.Write xmlStr
else
Response.Write objHTTP.Statu & "<br>"
Response.Write objHTTP.StatusText
end if
%>
- WEB客户端用ASP实现WEB服务的小例
- ASP.NETXMLWeb服务客户端创建Web服务
- ASP.NET+XML Web服务客户端创建Web服务
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用XFire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- 用xfire的Eclipse Plugin生成web服务的客户端
- ASP.NET+Web服务实现软件共享。
- ASP.NET+Web服务实现软件共享
- ASP.NET+Web服务实现软件共享
- WebSphere Web 服务交互的 .Net 客户端
- 基于SOAP的Web服务AJAX客户端
- 用.Net的Web服务实现天气预报
- CVS 用法
- 杨辉三角的参考资料
- 用ASP实现在线压缩与解压缩
- 用VB调用Webservice
- Jdk1.5安装
- WEB客户端用ASP实现WEB服务的小例
- 走近文件系统系列二:探索Dirty Bit的奥秘
- 早上赛事部的同事问了我个很基础的问题
- 研发管理的困难
- 推荐几个好用的软件
- BDB读、写、删除、更新事物、例子
- 关于成立一个软件工作室
- 世界杯时间表
- Win操作系统知识大全