Review of Making Web Service Calls
page 7 of 17
by Wenfeng Gao
Feedback
Average Rating: 
Views (Total / Last 10 Days): 76836/ 346
Article Contents:

Making Web Service Calls from ASPX Pages: The Sequence of Operations of an Asynchronous PreRequestHandler Execution

The following is the sequence of operations of an asynchronous PreRequestHandler execution.

  • Thread A executes the Global constructor (implemented in Global.asax). In the constructor, the AddOnPreRequestHandlerExecuteAsync method is called. Then Thread A executes Application_Start, Application_BeginRequest, etc.
  • Thread B executes BeginPreRequestHandlerExecute.
  • Thread C executes MyCallback, EndPreRequestHandlerExecute, Page_Load, and Application_EndRequest.

Thread A, Thread B and Thread C might be different depending on how many tasks in the thread pool.

 

There is a gap between Thread B and Thread C because there must be some thread(s) to queue the Web service calls, make the calls, receive the responses, and even launch a thread pool thread to execute MyCallback. At the first glance, one might argue that there is no thread gain because there always is (are) thread(s) sitting somewhere to do the tasks mentioned above even though Thread A and Thread B are freed. It is important to understand that the Web services “interface” is the XML message on the wire, not the class definition one may work with to process in VB or C#. Basically there is a dedicated group of threads that is responsible to queue the Web service calls, send and receive all SOAP messages. The following diagram illustrates that.

 

 

 

All the requests share the same group of threads. So we do have thread gain! This is the key why this approach is efficient.


View Entire Article

User Comments

Title: Code example   
Name: Sean Anderson
Date: 2009-05-26 8:02:17 AM
Comment:
Likewise, I would be very interested in seeing a working example of this, as I have read the article here (and the one on MSDN) both of which give a very good overview of the approach, but without a full example I am rapidly getting stuck.
Title: Great articles but...   
Name: Pascal
Date: 2009-05-21 7:38:29 AM
Comment:
Same comments, great articles but would be nice to have a sample code, not that easy to try when you don't know where you going.
Title: req sample code downloadable..   
Name: Karthik
Date: 2006-01-02 1:13:44 AM
Comment:
Hi,
the article was a nice one.
it would be more good if sample code(downloadable) for asynchronous webservices.
can that be done?

Regards,
Karthik






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-08 7:34:00 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search