Velocity Reviews

Velocity Reviews (
-   ASP .Net Web Services (
-   -   Unexpected Async Web Service behaviour (

Ross Porter 12-23-2003 05:12 PM

Unexpected Async Web Service behaviour
I am calling a web service asyncronously and polling the
IAsync result variable to determine if processing is
complete(using IsCompleted),nif not completed, I am
writing a message to the console ("still processing...").
The problem seems to be that the IAsync result variable's
IsCompleted property never retruns true so the loop is

Heres the code in vb: BTW -- the syncronous call is
working fine.

Sub Main()
Console.WriteLine("--------Begin Sync Call--------
Console.WriteLine("--------Begin Asyc Call--------
End Sub

Sub callsync()
Dim wR As New Web.WoodgroveOnlineBank
Dim aI As Web.Acct
aI = wR.GetAccount(1)
End Sub

Sub callasync()
Dim wR As New Web.WoodgroveOnlineBank
Dim cbObj As New AsyncCallback(AddressOf
Dim IAR As IAsyncResult = wR.BeginGetAccount(1,
cbObj, wR)
Do Until IAR.IsCompleted
Console.WriteLine("Still processing . . .")

End Sub

Sub CallBackMethod(ByVal ar As IAsyncResult)
Dim wR As Web.WoodgroveOnlineBank = ar.AsyncState
Dim act As Web.Acct
act = wR.EndGetAccount(ar)
End Sub
Sub WriteValues(ByVal aI As Web.Acct)
Console.WriteLine("Account {0} - {2} has a
balance of {1}", _
aI.accountID, _
aI.balance, _
End Sub

All times are GMT. The time now is 10:56 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.