By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

.net 2.0 asynchronous call did not work.

P: n/a
Someone help me please.

I've tried to write an asynchronous method, but it didn't call my web
service, do I need to do something in my webservice project to make it
work?

or if there is something wrong with the code that I have below.
Thanks..

The following are my two methods where one is calling web service and
second one is the delegate for callback method when asynchronous call
completed.

what I found is that it never went to the second sub that I created
when asynchornous finishes. weird... :(

sub CallWS()
Dim service As New CLWebService.service
service.Url = "http://localhost:2751/ws/Service.asmx"

'Add our callback function to the event handler
AddHandler service.GetConsultantsCompleted, AddressOf
GetConsultantsCallBack

'Call the Web service asynchronously
service.GetConsultantsAsync(#1/1/2005#, #1/5/2005#)

End Sub

Private Sub GetConsultantsCallBack(ByVal sender As Object, ByVal args
As CLWebService.GetConsultantsCompletedEventArgs)
Dim consultants() As CLWebService.Consultant = args.Result

Dim i As Integer = 1
For Each con As CLWebService.Consultant In consultants
Console.WriteLine(i.ToString & ". " & con.Name.Trim & " "
& con.Email.Trim)
i = i + 1
Next

End sub

Jul 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

kkao77 a écrit :
Someone help me please.

I've tried to write an asynchronous method, but it didn't call my web
service, do I need to do something in my webservice project to make it
work?

or if there is something wrong with the code that I have below.
Thanks..

The following are my two methods where one is calling web service and
second one is the delegate for callback method when asynchronous call
completed.

what I found is that it never went to the second sub that I created
when asynchornous finishes. weird... :(

sub CallWS()
Dim service As New CLWebService.service
service.Url = "http://localhost:2751/ws/Service.asmx"

'Add our callback function to the event handler
AddHandler service.GetConsultantsCompleted, AddressOf
GetConsultantsCallBack

'Call the Web service asynchronously
service.GetConsultantsAsync(#1/1/2005#, #1/5/2005#)

End Sub

Private Sub GetConsultantsCallBack(ByVal sender As Object, ByVal args
As CLWebService.GetConsultantsCompletedEventArgs)
Dim consultants() As CLWebService.Consultant = args.Result

Dim i As Integer = 1
For Each con As CLWebService.Consultant In consultants
Console.WriteLine(i.ToString & ". " & con.Name.Trim & " "
& con.Email.Trim)
i = i + 1
Next

End sub
Hello,
At first I would check that calling synchronously the WebService works.
Did you check the the service.Url is correct ?

Jul 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.