http://www.csdn.net/Develop/read_article.asp?id=23282
______________________________________________________________________________________________
答3:
安装Microsoft Soap Toolkit
Public Function Add() As String
Dim objSoapClient As New SoapClient
objSoapClient.ClientProperty("ServerHTTPRequest") = True
Call objSoapClient.mssoapinit("http://localhost/webserver/service1.asmx?WSDL", "Service1", "Service1Soap")
这句也可以
objSoapClient.mssoapinit("http://localhost/webserver/service1.asmx?WSDL")
Add = objSoapClient.Show("xxx")
End Function
______________________________________________________________________________________________
答4:
例:调用localhost/a.asmx下的web method:string test()
1,引用
解决方案管理器->引用->web引用->添加->打入:http://localhost/a.asmx
2,在程序中调用(设刚才的web 引用名为localhost)
localhost.a ws=new localhost.a();
string s=ws.test();
=========
另还一种方法是使用wsdl工具生成代理类,具体查msdn
______________________________________________________________________________________________
答5:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservice/using.asp
______________________________________________________________________________________________
答6:
(软件民工)兄,不知道你有没有这方面的例子,你给的网址看了还是没弄出来啊,谢谢了!
______________________________________________________________________________________________
答7:
这是我写的javascript函数,使用HTTP-Get协议在客户端调用Web Service。献丑了,呵呵!
//-----------------------------------------------------------------------------
//函数:HttpGetWebService
//功能:使用HTTP-GET协议条用WEB服务
//参数:服务URL地址、操作名称、操作所需的参数串
//返回:WEB服务返回的XML文档的根节点
//-----------------------------------------------------------------------------
function HttpGetWebService(wsUrl, opName, argsStr){
wsUrl += "/" + opName;
if(argsStr)
wsUrl += "?" + argsStr;
var xDoc = new ActiveXObject("microsoft.XMLDOM");
xDoc.async = false;
if(xDoc.load(wsUrl))
return xDoc.documentElement;
else
return false;
}
______________________________________________________________________________________________
答8:
var strSend = "<?xml version=/"1.0/" encoding = /"utf-8/"?>";
strSend += "<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//">";
strSend += "<soap:Body>";
strSend += "<myMethodxmlns=/"http://tempuri.org//">";
strSend += "<P1>" + document.all.TC.value + "</P1>";
strSend += "</myMethod>";
strSend += "</soap:Body>";
strSend += "</soap:Envelope>";
document.all.txtDisplay.innerText = strSend;
var httpMain=new ActiveXObject("Microsoft.XMLHTTP");
httpMain.Open("POST", "http://localhost/demo/22/TestService.asmx",false);
httpMain.setRequestHeader("Content-Type","text/xml");
httpMain.setRequestHeader("SOAPAction","http://tempuri.org/myMethod");
httpMain.Send(strSend);
if (httpMain.responseXML.xml!='')
{
document.all.txtDisplay2.innerText = httpMain.responseXML.xml;
}
______________________________________________________________________________________________
答9:
ms-help://MS.VSCC/MS.MSDNVS.2052/Behavior/workshop/author/webservice/overview.htm
______________________________________________________________________________________________
答10:
通过 Web 页使用 Web 服务
远程脚本的一个主要优点是:无需刷新 Web 页,就可以在客户端上调用服务器功能。现有的远程脚本客户端不能理解 Web 服务 XML,但这种优点并不会丢失,因为 WebService 行为与其非常相似,同时还提供了使用 HTTP POST 来调用服务器方法的突出功能。
远程脚本和 WebService 行为所共有的一项特性就是能够异步或同步调用方法。为自己的应用程序选择正确的机制是非常重要的,因为这对用户的体验有着显著的影响。调用 Web 服务可能需要一些时间,因此同步调用会锁住浏览器,这会令用户十分苦恼。这并不是说同步调用不好,而是强调应该在使用之前考虑一下其影响。
调用 getConditions 方法
2000 年 3 月的原示例中有一个简单的 Web 页。该页面接受文本框的值,调用 getConditions 方法,并用结果更新 Div。它先从远程脚本客户端 JScript 使用 RSGetASPObject 函数来获取 weatherservice.asp 页的客户端代理对象,再调用 getConditions 方法,然后再将 Div 的 innerHTML 设置为该方法的返回值。
svcWeather = RSGetASPObject("weatherservice.asp")
divWeather.innerHTML = svcWeather.getConditions(txtCity.value).return_value
这种方法的缺点在于它是同步的。换种方法,可以让页面使用 RSExecute 来处理要调用的方法的名称、参数以及当服务器的调用返回时要运行的函数的名称。
varTest = RSExecute("weatherservice.asp","getConditions",
txtCity.value,getConditionsCallBack)
使用 WebService 行为可以获得非常相似的结果。要向您的 Web 页添加 WebService 行为,需要将该行为指定给页面上的某个元素。在本文附带的示例页面中,我添加了一个 div 并向它指定了该行为。该行为的实现形式是 HTML 组件 (.htc),因此可将它安装到您的 Web 服务器上。
<div id=service style="BEHAVIOR: url(webservice.htc)"></div>
WebService 行为中与 RSGetASPObject 对应的函数是 UseService。UseService 可以创建一个客户端对象的实例,以便访问所提供的 Web 服务上的所有方法。例如,service.useService("clsWeather.asmx?WSDL","svcWeather") 将在服务对象上创建一个属性 svcWeather,并为其指定一个基于 clsWeather.asmx Web 服务的客户端对象。创建该对象后,远程方法的调用将通过以下方式完成:在返回的对象上调用 callService 方法,并使用回调函数的名称、Web 服务上的方法及其参数作为该方法的参数。当返回 getConditions 方法时,WebService 行为会调用 showWeather 函数,该函数把 innerHTML 设置为返回结果的值。
service.useService("clsWeather.asmx?WSDL","svcWeather")
// 在 svcWeather Web 服务上调用 getConditions 方法
iCallID = service.svcWeather.callService(showWeather,"getConditions",txtCity.value)
function showWeather(result)
{
// 显示状况
divWeather.innerHTML = result.value
}
http://www.microsoft.com/china/msdn/library/dndotnetclinic/html/scripting11122001.asp