472,779 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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 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;
}
}

--
Kalyan
Nov 8 '07 #1
2 1570
=?Utf-8?B?S2FseWFu?= <Ka****@discussions.microsoft.comwrote in
news:AA**********************************@microsof t.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.
Nov 8 '07 #2
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/bruc...0/02/3480.aspx

You can read more on this in the "Asynchronous 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 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;
}
}

--
Kalyan
Nov 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Marty McDonald | last post by:
I create and start several threads, each thread executes the same method - within the method, a web service is invoked. I find that the more threads I use, the longer it takes for all of the...
8
by: TC | last post by:
Hello, I am making an asynchronous call to a webservice and trying to update the web page with the results. The page is not updating. Does anybody know why??? Below is my code:
4
by: Tim Gallivan | last post by:
Hello group, I'm trying to develop a proof of concept webservice which asynchronously calls a function in a DLL. The function raises an event when it is finished, and works when used as part of...
4
by: jim | last post by:
Hi All, I try to make an asynchronous call to a web service method as below under MS visual .NET studio 2003: WebService webSrv = new WebService(); AsyncCallback cb = new...
5
by: SenthilVel | last post by:
Hi Can any one let me know how i can perform a Asychronous calll in a web service ? or using a thread in Asmx a better solution than the async call ? pls send me any link to example, where...
0
by: Raymondr | last post by:
Hi, First a brief description of out application: We have a webapplication which calls a couple of webservices during one request (postback). These calls to the webservices are made concurrent...
1
by: kkao77 | last post by:
Someone help me please. I've tried to write an asynchronous method, but it didn't call my web service, do I need to do something in my webservice project to make it work? or if there is...
10
by: Susan | last post by:
I have a process that takes a while to run so I have it running asynchronously so that the user can continue working. My question is that I want to killl the process if the user changes the search...
0
by: sirmoreno | last post by:
Hi, In my web site I have some long tasks that I want to call without delaying the page rendering - without making the thread that handels the page request wait for the long task to end. I...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.