Asynchronous WEb Services

Discussion in 'ASP .Net Web Services' started by tshad, Mar 23, 2006.

  1. tshad

    tshad Guest

    I have a web service I am calling asynchronously, but I need to make sure I
    finish my call.

    For example:

    ****************************************************************
    public NewHire()
    {
    sessionID = "150";
    GetInitialNewHireData();
    GetNewHire(241);
    System.Threading.Thread.Sleep(20000);
    }
    public void GetInitialNewHireData()
    {
    System.IAsyncResult asyncResult;

    asyncResult = newHireService.BeginreadNewHire(
    companyNumber,
    "",
    session,new AsyncCallback(CallBackInitial), null);
    }

    public void CallBackInitial(IAsyncResult oRes)
    {
    nh = newHireService.EndreadNewHire(oRes);
    }

    private void GetNewHire(int applicantID)
    {
    Some Code
    }
    ***************************************************************

    In the above code, I need to make sure that CallBackInitial finishes before
    I exit NewHire.

    At the moment, just for testing, I am going to sleep for 20 seconds (which
    is not what I want). What I could do is set up a "while loop" that goes to
    a sleep for a time (thread.sleep(240)) that is looking at some variable to
    see when it changes.

    Is there a better way to tell NewHire not to exit until the Call back is
    finished?

    Thanks,

    Tom
     
    tshad, Mar 23, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gary Howlett

    Asynchronous Web Services

    Gary Howlett, Aug 19, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    433
    Natty Gur
    Aug 19, 2003
  2. Dave
    Replies:
    0
    Views:
    132
  3. Bill Zack
    Replies:
    4
    Views:
    143
  4. David Cornelson

    Asynchronous Web Services called from ASP.NET

    David Cornelson, Dec 8, 2003, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    152
    Ágúst
    Dec 9, 2003
  5. sing

    Asynchronous Web Services

    sing, Feb 16, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    175
    Sami Vaaraniemi
    Feb 17, 2004
Loading...

Share This Page