Calling a Web Service Asynchronously

To demonstrate calling a Web Service asynchronously, we will begin by creating a Web Service that will be consumed in all of the examples that follow.

Listing 8.1 demonstrates a Web Service with a WebMethod that will take some time to execute. Create a new Web Service Project called VirtualFlights. Add Listing 8.1 to the service.

Listing 8.1. Flights.asmx.vb Shows the Source Code for a Slow Web Service
 Imports System.Web.Services Imports System.Threading Public Class Flights Inherits System.Web.Services.WebService <WebMethod()> Public Function FlightSearch( _ ByVal Departure As String, _ ByVal Destination As String, _ ByVal DepartureDate As Date, _ ByVal ReturnDate As Date, _ ByRef Flight As String, _ ByRef ...

Get Creating and Consuming Web Services in Visual Basic® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.