国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

香港云服务器
服務器之家 - 編程語言 - ASP教程 - ASP調用WebService轉化成JSON數據,附json.min.asp

ASP調用WebService轉化成JSON數據,附json.min.asp

2019-06-18 10:58yourber ASP教程

接觸WebService也很久了,但是使用asp調用教程的卻不多,還有轉成json也不多見,本文全部分享給大家,需要的拿去吧。

首先定義SOAP數據,然后創建HTTP對象,然后使用POST提交,獲取狀態碼為200,就說明調用成功,再進行下一步操作……

看一下具體實現的代碼吧

01<!--#Include virtual="/Include/json.min.asp"-->
02<%
03Dim strxml
04Dim str
05 
06'定義soap消息
07strxml = "<?xml version='1.0' encoding='utf-8'?>"
08strxml = 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/'>"      
09strxml = strxml & "<soap:Body> "
10strxml = strxml & "<GetCategories xmlns='http://tempuri.org/'>"
11strxml = strxml & "<reqcode>30000001</reqcode>" '參數1
12strxml = strxml & "<sign>ssssss</sign>" '參數2
13strxml = strxml & "</GetCategories>"
14strxml = strxml & "</soap:Body>"
15strxml = strxml & "</soap:Envelope>"
16 
17Set h = createobject( "Microsoft.XMLHTTP")
18'向指定的URL發送Post消息
19h.open "POST", "http://www.domain.com/WebService.asmx", False
20h.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
21h.setRequestHeader "Content-Length",LEN(strxml)
22h.setRequestHeader "SOAPAction", "http://tempuri.org/GetCategories"
23h.send (strxml)
24 
25'顯示返回的XML信息
26 
27If h.Status = 200 Then
28  Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
29  xmlDOC.load(h.responseXML)
30  jsonText = xmlDOC.childNodes(1).Text
31   
32  '轉換成JSON,調用json.min.asp
33  Set categories = JSON.parse(jsonText)
34   
35  for i = 0 to categories.Length -1
36    Response.Write(CStr(categories.get(i).CategoryName)) '屬性
37    for j = 0 to categories.get(i).Labels.Length - 1 '集合
38      Response.Write(CStr(categories.get(i).Labels.get(j).LabelName))
39    next
40  next
41  <pre name="code" class="vb"><script language="javascript" runat="Server">
42if(!Array.prototype.get){Array.prototype.get=function(prop){return this[prop];}}"use strict";if(!this.JSON){JSON={};}
43(function(){function f(n){return n<10?'0'+n:n;}
44if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
45f(this.getUTCMonth()+1)+'-'+
46f(this.getUTCDate())+'T'+
47f(this.getUTCHours())+':'+
48f(this.getUTCMinutes())+':'+
49f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
50var cx=/[\?\?\?-\?\?\?\?\?-\?\?-\?\?-\?\?\?-\?]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\?\?-\?\?\?\?\?-\?\?-\?\?-\?\?\?-\?]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
51function 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);}
52if(typeof rep==='function'){value=rep.call(holder,key,value);}
53switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
54gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
55v=partial.length===0?'[]':gap?'[\n'+gap+
56partial.join(',\n'+gap)+'\n'+
57mind+']':'['+partial.join(',')+']';gap=mind;return v;}
58if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
59v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
60mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
61if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
62rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
63return str('',{'':value});};}
64if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
65return reviver.call(holder,key,value);}
66cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
67('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
68if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/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;}
69throw new SyntaxError('JSON.parse');};}}());
70</script>
71Set xmlDOC = nothingElse Response.Write h.Status &" " Response.Write h.StatusTextEnd if%>

 

附:json.min.asp
01<script language="javascript" runat="Server">
02if(!Array.prototype.get){Array.prototype.get=function(prop){return this[prop];}}"use strict";if(!this.JSON){JSON={};}
03(function(){function f(n){return n<10?'0'+n:n;}
04if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
05f(this.getUTCMonth()+1)+'-'+
06f(this.getUTCDate())+'T'+
07f(this.getUTCHours())+':'+
08f(this.getUTCMinutes())+':'+
09f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
10var cx=/[\?\?\?-\?\?\?\?\?-\?\?-\?\?-\?\?\?-\?]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\?\?-\?\?\?\?\?-\?\?-\?\?-\?\?\?-\?]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
11function 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);}
12if(typeof rep==='function'){value=rep.call(holder,key,value);}
13switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
14gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
15v=partial.length===0?'[]':gap?'[\n'+gap+
16partial.join(',\n'+gap)+'\n'+
17mind+']':'['+partial.join(',')+']';gap=mind;return v;}
18if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
19v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
20mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
21if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
22rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
23return str('',{'':value});};}
24if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
25return reviver.call(holder,key,value);}
26cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
27('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
28if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/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;}
29throw new SyntaxError('JSON.parse');};}}());
30</script>

 

延伸 · 閱讀

精彩推薦
677
主站蜘蛛池模板: 久久综合一区二区三区 | 麻豆激情 | 国产精品久久久久久久 | 亚洲精品第一 | 成年人xxxx| 中文字幕高清av | 国产高清在线精品一区二区三区 | 欧美二三区| 高清国产一区二区三区 | 国产高清自拍 | 狼人综干网| 亚洲精品一区二区三区四区高清 | 91精品久久久久久久久 | 欧美一级免费高清 | 成人免费视频网 | 天天影视网色香欲综合网无拦截 | 日韩一区二区在线播放 | 欧美在线视频不卡 | 日韩欧美中字 | 久久久免费网站 | 国产午夜精品视频 | 动漫卡通精品一区二区三区介绍 | 欧美日韩在线电影 | 国产日产久久高清欧美一区 | jlzzjlzz国产精品久久 | 久久成人国产精品 | 一级全黄少妇性色生活片免费 | 爱操av| 在线播放亚洲 | 亚洲精品欧美 | 久久小视频 | 激情综合五 | 日韩高清中文字幕 | 电影在线观看免费 | 五月天婷婷在线视频 | 99热最新网站 | 久久久国产精品免费观看 | 国产精品一区二 | 一区不卡 | 有码一区 | 狠狠av |