zoukankan      html  css  js  c++  java
  • 通过WebService调用产品数据ASP客户端实例

    Response.Expires=-1 curPage=request.QueryString("curPage") Keywords=request.QueryString("keywords") if curPage="" then curPage="1" strMyICList=GetMyICListForHtml(43,curPage,30,keywords) Response.Write strMyICList Function GetMyICListForHtml(userID,curPage,pageSize,keywords) '######################################################### '函数名称:GetMyICListForHtml '版本:For.ASP.V1.0 '功能描述:取得我的IC产品当前页Html列表 '参数说明: ' userID 您的用户ID 整型数字 ' curPage 当前要显示的页码 整型数字 ' pageSize 每页要显示的产品数量 整型数字 ' keywords 搜索关键词(2个或2个以上字符) 字符串 '返回说明: ' 返回IC产品当前页Html列表 字符串 '######################################################### 'On Error Resume Next err.Clear() '定义变量 Dim strUrl,strData Dim xmlHttp,xmlDoc,strResult strResult="" '初始 WebService URL strUrl="http://192.168.1.88/ECS/Products.asmx/GetMyICListForHtml" strData="userID=" & userID & _ "&curPage=" & curPage & _ "&pageSize=" & pageSize & _ "&keywords=" & keywords strUrl=strUrl & "?" & strData '创建XMLHTTP对象 Set xmlHttp = Server.CreateObject("Msxml2.XMLHTTP") xmlHttp.open "GET",strUrl,false xmlHttp.Send()'发送一个HTTP GET 请求 '当返回的Http状态为200即表示请求数据成功 if xmlHttp.status=200 then '创建DOMDocument对象 Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument") xmlDoc.async = False xmlDoc.Load (xmlHttp.responseXML)'装载服务器端返回的XML If xmlDoc.parseError.errorcode <> 0 Then GetMyICListForHtml="错误信息:" & xmlDoc.parseError.reason Exit Function else 'response.Write xmlDoc.xml if xmlDoc.documentElement.childNodes.length=0 then strResult="没有记录" else strResult=xmlDoc.documentElement.childNodes.Item(0).text end if end if '当返回的Http状态不为200时 else GetMyICListForHtml="下面是服务器端返回的错误信息,可能是你所发送的strData不正确所导致:
    Http Status:" & xmlHttp.status & "
    Http Status Text:" & xmlHttp.statusText & "
    " Exit Function end if if err.number<>0 then GetMyICListForHtml="错误信息:" & err.Description err.Clear() else GetMyICListForHtml=strResult end if End Function

  • 相关阅读:
    实用的设计模式【一】---类设计法则
    vimium 使用心得
    记一次给部门做分享的心得
    centos7安装docker和docker compose【转】
    docker 部署 jenkins
    centos删除docker0虚拟网卡
    CentOS7查看和关闭防火墙
    .Net Core Autofac实现依赖注入
    【转】Docker基础
    【转】使用Docker+Jenkins自动构建部署
  • 原文地址:https://www.cnblogs.com/Ray/p/2954.html
Copyright © 2011-2022 走看看