Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Calling Async object within a webservice method

Thread Tools

Calling Async object within a webservice method

Paul Hadfield
Posts: n/a

From reading various articles on scalability issues, I understand that there
is only a finite number of ASP.NET worker threads and any long running task
within ASP.NET should be fired off on a seperate thread using an async call.
All the articles I can find are either on implementing an async webpage, or
calling an async webservice. I can not however find any article on how to
make calls within a webservice asynchronous. Consider the following:

public int LongRunningTask(int inputValue)
BusinessObject bo = new BusinessObject();
return bo.Process(inputValue); // This typically takes 1-10 seconds,
but could take up to one minute!

Now "BusinessObject" implements the Microsoft "Asynchronous Design Pattern",
having "BeginProcess()" and "EndProcess()" methods, implementing callback,
IAsyncResult and state. But how do you call this in the web method? Is
there any way to hide the fact from the webservice consumer that the call to
the business object is asynchronous? Unlike Page, the base class WebService
doesn't appear to expose any ability to register call backs for any sort of
async call.

My gut feel is that the above is not possible, therefore I have to make the
webservice webmethod asynchronous (i.e. have webmethods
"BeginLongRunningTask" and "EndLongRunningTask"). How do I implement this,
hiding the non-async LongRunningTask() webmethod, as I won't want anyone to
consume that webmethod.


- Paul.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asynchronous Call of WebService method within a WebService RenÚ Preu▀ler ASP .Net Web Services 0 10-29-2008 11:55 AM
Newbie: async mode dedicated versus async mode interactive!! Pink_Floyd Cisco 4 06-16-2006 12:16 AM
Async webservice call in async webpage (.Net 2.0) does not return Steven ASP .Net Web Services 0 11-30-2005 01:06 AM
Problem calling a COM object within my webservice - please help.... Michael ASP .Net Web Services 3 12-23-2003 07:48 PM
Problem calling a COM object within my webservice - please help.... Michael ASP .Net Web Services 2 12-19-2003 08:40 PM