none
How to Chain async call's RRS feed

  • Question

  • Hi All,

    We are trying to call the web service which in turn call's another web service. The problem we are facing here is  the web service is a async and it can't wait for the another web service call back,But we get the data only after the second web service call back and that data we have to push it to the first service call back. So Is there any mechanism to make the first web service to wait till the second completes .

    NOTE: We tried the following link but we are unable to overcome from the issue.

    http://msdn.microsoft.com/en-us/library/dwba7yy7(v=vs.80).aspx.

    Thanks & Regards

    Ashwij

    Wednesday, December 4, 2013 11:27 AM

Answers

  • Hi,

    If you wan to make the first web service to wait until the second completes, maybe you can try the following:

    IAsyncResult ar = request.BeginGetResponse(new AsyncCallback(Callback), request);
    ar.AsyncWaitHandle.WaitOne(5000);

    In this particular case I am using the timed out version of WaitOne() which returns true if the wait was successful. You could use any of the WaitOne() overloads though.

    Or please try to use the IsCompleted property of the IAsyncResult returned by the asynchronous operation's BeginOperationName method which will determine whether the operation has completed. If completed, then let it await.

    For more information, please try to refer to:

    #Polling for the Status of an Asynchronous Operation:
    http://msdn.microsoft.com/en-us/library/ms228968.aspx .

    #Using an AsyncCallback Delegate to End an Asynchronous Operation:
    http://msdn.microsoft.com/en-us/library/ms228972.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 6, 2013 7:09 AM
    Moderator