all groups > dotnet web services > november 2007 >
You're in the

dotnet web services

group:

Efficient Asynchronous Call to Webservice


Efficient Asynchronous Call to Webservice Kalyan
11/8/2007 10:41:02 AM
dotnet web services:
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 WebServiceCallsXY(string x, string y)
{
try
{
UsernameToken token = new UsernameToken("AAA", "BBB",
PasswordOption.SendPlainText);
MbrSrvWse wseProxy = new MbrSrvWse ();
wseProxy.SetClientCredential<UsernameToken>(token);
wseProxy.SetPolicy("ProvideUsernameToken");

IndividualDetailRequest test = new IndividualDetailRequest();
test.UserId = x;
test.Pin = y;
IndividualDetailResponse response =
wseProxy.IndividualDetail(test);

if (response.Result.Length > 0)
{
if (response.Result.ToString().ToLower().Equals("a"))
{
return true;
}
if (response.Result.ToString().ToLower().Equals("b"))
{
return false;
}
}
return false;
}
catch (Exception e)
{
Console.WriteLine("The following error '{0}' -------- {1} :
{2} ", e.Message, e.StackTrace, x);
return false;
}
}

--
Re: Efficient Asynchronous Call to Webservice Spam Catcher
11/8/2007 11:19:36 PM
=?Utf-8?B?S2FseWFu?= <Kalyan@discussions.microsoft.com> wrote in
news:AAAA4E67-4014-4170-87DF-9D341010868D@microsoft.com:

[quoted text, click to view]

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
RE: Efficient Asynchronous Call to Webservice Dave
11/13/2007 6:12:01 AM
I don't think VS2005 creates the Begin/End methods for you like VS2003 did.
instead it creates <methodname>Async & <methodname>Completed events.

See http://objectsharp.com/cs/blogs/bruce/archive/2005/10/02/3480.aspx

You can read more on this in the "Asynchronous Tasks" at
http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/

Good example..
http://msdn2.microsoft.com/en-us/library/system.web.ui.pageasynctask(VS.80).aspx

[quoted text, click to view]
AddThis Social Bookmark Button