无为清净楼资源网 Design By www.qnjia.com

首先定义SOAP数据,然后创建HTTP对象,然后使用POST提交,获取状态码为200,就说明调用成功,再进行下一步操作……

看一下具体实现的代码吧

<!--#Include virtual="/Include/json.min.asp"-->
<%
Dim strxml
Dim str

'定义soap消息
strxml = "<"
strxml = strxml & "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"       
strxml = strxml & "<soap:Body> "
strxml = strxml & "<GetCategories xmlns='http://tempuri.org/'>"
strxml = strxml & "<reqcode>30000001</reqcode>" '参数1
strxml = strxml & "<sign>ssssss</sign>" '参数2
strxml = strxml & "</GetCategories>"
strxml = strxml & "</soap:Body>"
strxml = strxml & "</soap:Envelope>"

Set h = createobject( "Microsoft.XMLHTTP")
'向指定的URL发送Post消息
h.open "POST", "http://www.domain.com/WebService.asmx", False
h.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
h.setRequestHeader "Content-Length",LEN(strxml)
h.setRequestHeader "SOAPAction", "http://tempuri.org/GetCategories"
h.send (strxml)

'显示返回的XML信息

If h.Status = 200 Then
  Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
  xmlDOC.load(h.responseXML)
  jsonText = xmlDOC.childNodes(1).Text 
  
  '转换成JSON,调用json.min.asp
  Set categories = JSON.parse(jsonText)
  
  for i = 0 to categories.Length -1
    Response.Write(CStr(categories.get(i).CategoryName)) '属性
    for j = 0 to categories.get(i).Labels.Length - 1 '集合
      Response.Write(CStr(categories.get(i).Labels.get(j).LabelName))
    next
  next
  <pre name="code" class="vb"><script language="javascript" runat="Server">
if(!Array.prototype.get){Array.prototype.get=function(prop){return this[prop];}}"use strict";if(!this.JSON){JSON={};}
(function(){function f(n){return n<10"\x00-\x1f\x7f-\x9f\"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)"\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-" " Response.Write h.StatusTextEnd if%>

附:json.min.asp
<script language="javascript" runat="Server">
if(!Array.prototype.get){Array.prototype.get=function(prop){return this[prop];}}"use strict";if(!this.JSON){JSON={};}
(function(){function f(n){return n<10"\x00-\x1f\x7f-\x9f\"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)"\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());
</script>
标签:
ASP,WebService,JSON

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。

更新日志