Link to home
Start Free TrialLog in
Avatar of jimseiwert
jimseiwertFlag for United States of America

asked on

silverlight Asynchronous web service calls

I am trying to call two web service at the same time. I read that I need to use the user state object. Below is my code. Every time I execute them only one returns. The other service returns the error message " an exception occurred during the operation making the result set invalid"

What do I need to change to get these calls to work correctly. Thank you in advance.
Public Sub logoncommands()
        UserInformation.ReturnUserFullNameAsync(Guid.NewGuid)
        UserInformation.ReturnRoleIDAsync(Guid.NewGuid)
    End Sub

 Private Sub UserNameReturned(ByVal sender As Object, ByVal e As UserInfo.ReturnUserFullNameCompletedEventArgs) Handles UserInformation.ReturnUserFullNameCompleted
        Dim g As Guid = e.UserState
        Me.lbl_username.Content = Format("Welcome {0}", e.Result.ToString)
    End Sub

Open in new window

Avatar of Aaron Jabamani
Aaron Jabamani
Flag of United Kingdom of Great Britain and Northern Ireland image

You have called the web service but the code to callback are missing for both the calls.

for eg. for the method, UserInformation.ReturnUserFullNameAsync, you should see "UserInformation.ReturnUserFullNameCompleted" event.  Add a event handler to this call back method. The same way you have to do for other also.
Avatar of jimseiwert

ASKER

I do have the call backs for the code. I gave one example of the call back up there UserNameReturned is for UserInformation.ReturnUserFullNameCompleted

I did not put the other one as I was just showing example of how I am handiling tyhe callback. I am still tying to figure out how to call both webservices at the same time without getting the error message " an exception occurred during the operation making the result set invalid".
ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Correct. I get an error when I call two web services at the same time so if I call service 1 and service 2 before service 1 fails then I get the error. I am trying to find a way to call both services at the same time.

Acording to microsoft I have to pass it a user state object to do this. I tried using GUID as the object but that did not work.
Avatar of Gautham Janardhan
Gautham Janardhan

can you debug and see what error your service is throwing.. the code i posted will help you. also are you using FaultException in the server side so that the errors are propagated to the client ?