New Event-Based Model For Asynchronous WebMethod Calls
ASP.NET Web Services supports a new model for asynchronous WebMethod calls. Use the
event-based model to asynchronously call your Web services. This sample shows how
to define your callback function and add it to your proxy class' event handler. When
the method call returns, your callback function will be called.
'First implement the HelloWorldCompleted method using the following signature:
'public void HelloWorldCompleted(object sender, HelloWorldCompletedEventArgs args)
'Create the Web service
Dim service As New HelloWorldWaitService()
'Add our callback function to the event handler
AddHandler service.HelloWorldCompleted, AddressOf HelloWorldCompleted
'Call the Web service asynchronously
service.HelloWorldAsync("first call")
'when the Web service call returns the HelloWorldCompleted method will be called
VB
VB Sample Caption
Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.
|