zoukankan
html css js c++ java
客户端调用WebService方法
一. 建WebService.asmx
二.修改配置文件
<
system.web
>
<
webServices
>
<
protocols
>
<
add name
=
"
HttpGet
"
/>
<
add name
=
"
HttpPost
"
/>
<
add name
=
"
HttpSoap
"
/>
<
add name
=
"
Documentation
"
/>
</
protocols
>
</
webServices
>
</
system.web
>
三.WebService.cs添加方法:
[WebMethod]
//
标志 ,必填
public
IList getList()
{
IList list
=
new
ArrayList();
list.Add(
"
a
"
);
list.Add(
"
b
"
);
return
list;
}
四.客户端调用
//
声明DOC
var doc;
if
(window.ActiveXObject)
{
doc
=
new
ActiveXObject(
"
Microsoft.XMLDOM
"
);
}
else
{
if
(document.implementation
&&
document.implementation.createDocument)
{
doc
=
document.implementation.createDocument(
""
,
"
doc
"
,
null
);
}
}
doc.async
=
"
false
"
;
//
xmlDom.preserveWhiteSpace=true;
//
是否保留空格
window.onload
=
function()
{
doc.load(
"
http://localhost:4863/WebService1.asmx/getList
"
);
var arr
=
doc.text;
alert(arr);
}
,
这个送给你!
查看全文
相关阅读:
LOJ6274 数字
test20200415 看门人 和 WC2010 重建计划
TJOI2018 Party 和 HDU4352 XHXJ's LIS
LOJ3228 Tree Depth
AGC026D Histogram Coloring
LOJ3277 星座 和 BZOJ2616 PERIODNI
LOJ2331 某位歌姬的故事 和 CF1327F AND Segments
AGC024F Simple Subsequence Problem
LOJ3278 收获
LOJ3282 治疗计划
原文地址:https://www.cnblogs.com/di305449473/p/1223034.html
最新文章
stm32(2):库函数点灯
数据结构(2) —— 线性表
stm32(1): 寄存器初使用
1216E
洛谷P3237 [HNOI2014]米特运输
Subset(POJ-3977)
洛谷P2607 [ZJOI2008]骑士
CF1215D Ticket Game
Codeforces834C The Meaningless Game
CF55D Beautiful numbers
热门文章
洛谷P2827 NOIP2016 蚯蚓
洛谷P2566[SCOI2009]围豆豆
POJ 1852 Ants
LOJ6037 猜数列
LOJ6031 字符串
AGC022E Median Replace
CF1110H Modest Substrings
FJOI2016 建筑师 和 CF960G Bandit Blues
test20200415 游戏 和 NOI2011 兔兔与蛋蛋游戏
CF700E Cool Slogans 和 CF1063F String Journey
Copyright © 2011-2022 走看看