There was a requirement that you would be able to cancel an ongoing web Service. This is the first time I have ever met this function, but it's not difficult, I think. Now that asp.net AJAX client and server-side communication is done entirely through the asynchronous communication layer of the Microsoft Ajax Library, we simply get the request for Web Service Sys.Net.WebRequest object, call its Abort method on it. But how exactly should this object be obtained? So I read the code roughly.
First, suppose the following Web service method definition (demoservice.asmx):
[ScriptService]
public class DemoService : System.Web.Services.WebService
{
[WebMethod]
public string DemoMethod()
{
return "Hello World";
}
}
Accessing the Demoservice.asmx/jsdebug (or after using ScriptManager references to the page) will enable you to get the following proxy (fragment, typesetting) class.
var DemoService = function()
{
DemoService.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
DemoService.prototype =
{
DemoMethod:function(succeededCallback, failedCallback, userContext)
{
return this._invoke(
DemoService.get_path(),
'DemoMethod',
false,
{},
succeededCallback,
failedCallback,
userContext);
}
}
DemoService.registerClass('DemoService',Sys.Net.WebServiceProxy);
...