加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Calling WebServices using Javascript

发布时间:2020-12-17 02:59:42 所属栏目:安全 来源:网络整理
导读:If you are using Microsoft IE 5 or later,you can use the behavior/HTML-Component "WebService" to access a Web service. The "WebService" behavior communicates with Web services over HTTP using Simple Object Access Protocol (SOAP). To use th

If you are using Microsoft IE 5 or later,you can use the behavior/HTML-Component "WebService" to access a Web service. The "WebService" behavior communicates with Web services over HTTP using Simple Object Access Protocol (SOAP).

To use the "WebService" behavior,you must attach it to an element using the STYLE attribute,as follows:

<DIV ID="GiveItAName"
STYLE="behavior:url(webservice.htc)"></DIV>

A complete example taken from the Microsoft Web site is as follows:

<html>
<head>
<script language="JavaScript">
var iCallID;

function init()
{
service.useService
("
http://myserver.com/services/myservice.asmx?WSDL",
?????????????????? "servicename");
}

function onmyresult()
{
?? if ((event.result.error)&&(iCallID==event.result.id))
?? {
????? var xfaultcode = event.result.errorDetail.code;
????? var xfaultstring = event.result.errorDetail.string;
????? var xfaultsoap = event.result.errorDetail.raw;

????? // Add code to output error information here
????? alert("Error ");
?? }
?? else
?? {
????? service.innerHTML= "The method returned the result: "
???????????????????????? + event.result.value;
?? }
}
</script>
</HEAD>
<body onload="init();">
<BR>
Enter a Value <input type='text' id='param1'>
<BR>
<button onclick='iCallID = service.servicename.callService
("ProcedureName",param1.value);'>Call A Web Method</button>
<div id="service"
???? style="behavior:url(webservice.htc)"
???? onresult="onmyresult();">
</div>
</body>
</html>

source: http://weblogs.asp.net/Varad/archive/2004/06/14/155671.aspx

posted on 2004-06-15 18:47 ccBoy 评论(3)?收藏

评论

#?re: Calling WebServices using Javascript 2004-06-15 21:15 hBifTs

呵呵,是的,以前也看到过:)

#?re: Calling WebServices using Javascript 2004-06-16 20:49 ccBoy

其实这篇更好
Remote?Scripting?in?a?.NET?World
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting11122001.asp

Scripting?Web?Services
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting03132000.asp ?target="_new"?href="http:> ?target="_new"?href="http:>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读