Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   Unexpected Async Web Service behaviour (http://www.velocityreviews.com/forums/t782426-unexpected-async-web-service-behaviour.html)

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
infinite.

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

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

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

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

End Sub

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