Efficient Asynchronous Call to Webservice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?S2FseWFu?=

    #1

    Efficient Asynchronous Call to Webservice

    Hi,

    I have to make multiple calls (about 400K) to a webservice which returns a
    string. And currently it takes about a week to make all the calls. Instead of
    waiting for the webservice result before i make the next call, I rather want
    to make the calls and let the results comeback at its own pace. I used
    Asynchronous calling and callback method, but it does not seems to work. I am
    sure, asynchronous way will improve my program execution exponentially. I
    would appreciate if someone can help me with this. And by the way, i did not
    see an Begin and End methods.


    Here is my method which is making the webservice calls.

    public static Boolean WebServiceCalls XY(string x, string y)
    {
    try
    {
    UsernameToken token = new UsernameToken(" AAA", "BBB",
    PasswordOption. SendPlainText);
    MbrSrvWse wseProxy = new MbrSrvWse ();
    wseProxy.SetCli entCredential<U sernameToken>(t oken);
    wseProxy.SetPol icy("ProvideUse rnameToken");

    IndividualDetai lRequest test = new IndividualDetai lRequest();
    test.UserId = x;
    test.Pin = y;
    IndividualDetai lResponse response =
    wseProxy.Indivi dualDetail(test );

    if (response.Resul t.Length 0)
    {
    if (response.Resul t.ToString().To Lower().Equals( "a"))
    {
    return true;
    }
    if (response.Resul t.ToString().To Lower().Equals( "b"))
    {
    return false;
    }
    }
    return false;
    }
    catch (Exception e)
    {
    Console.WriteLi ne("The following error '{0}' -------- {1} :
    {2} ", e.Message, e.StackTrace, x);
    return false;
    }
    }

    --
    Kalyan
  • Spam Catcher

    #2
    Re: Efficient Asynchronous Call to Webservice

    =?Utf-8?B?S2FseWFu?= <Kalyan@discuss ions.microsoft. comwrote in
    news:AAAA4E67-4014-4170-87DF-9D341010868D@mi crosoft.com:
    I have to make multiple calls (about 400K) to a webservice which
    returns a string. And currently it takes about a week to make all the
    calls. Instead of waiting for the webservice result before i make the
    next call, I rather want to make the calls and let the results
    comeback at its own pace. I used Asynchronous calling and callback
    method, but it does not seems to work. I am sure, asynchronous way
    will improve my program execution exponentially. I would appreciate if
    someone can help me with this. And by the way, i did not see an Begin
    and End methods.
    Surely you must have a better way ... ???

    Do you have access to the developer who built the original web service?
    Perhaps you can make a bulk call.

    As for asynchronous web services, .NET 2.0 uses events rather than
    Begin/End functions.

    Comment

    • =?Utf-8?B?RGF2ZQ==?=

      #3
      RE: Efficient Asynchronous Call to Webservice

      I don't think VS2005 creates the Begin/End methods for you like VS2003 did.
      instead it creates <methodname>Asy nc & <methodname>Com pleted events.

      See http://objectsharp.com/cs/blogs/bruc...0/02/3480.aspx

      You can read more on this in the "Asynchrono us Tasks" at
      http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

      Good example...
      http://msdn2.microsoft.com/en-us/lib...sk(VS.80).aspx

      "Kalyan" wrote:
      Hi,
      >
      I have to make multiple calls (about 400K) to a webservice which returns a
      string. And currently it takes about a week to make all the calls. Instead of
      waiting for the webservice result before i make the next call, I rather want
      to make the calls and let the results comeback at its own pace. I used
      Asynchronous calling and callback method, but it does not seems to work. I am
      sure, asynchronous way will improve my program execution exponentially. I
      would appreciate if someone can help me with this. And by the way, i did not
      see an Begin and End methods.
      >
      >
      Here is my method which is making the webservice calls.
      >
      public static Boolean WebServiceCalls XY(string x, string y)
      {
      try
      {
      UsernameToken token = new UsernameToken(" AAA", "BBB",
      PasswordOption. SendPlainText);
      MbrSrvWse wseProxy = new MbrSrvWse ();
      wseProxy.SetCli entCredential<U sernameToken>(t oken);
      wseProxy.SetPol icy("ProvideUse rnameToken");
      >
      IndividualDetai lRequest test = new IndividualDetai lRequest();
      test.UserId = x;
      test.Pin = y;
      IndividualDetai lResponse response =
      wseProxy.Indivi dualDetail(test );
      >
      if (response.Resul t.Length 0)
      {
      if (response.Resul t.ToString().To Lower().Equals( "a"))
      {
      return true;
      }
      if (response.Resul t.ToString().To Lower().Equals( "b"))
      {
      return false;
      }
      }
      return false;
      }
      catch (Exception e)
      {
      Console.WriteLi ne("The following error '{0}' -------- {1} :
      {2} ", e.Message, e.StackTrace, x);
      return false;
      }
      }
      >
      --
      Kalyan

      Comment

      Working...