473,666 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 8 '07 #1
2 1617
=?Utf-8?B?S2FseWFu?= <Ka****@discuss ions.microsoft. comwrote in
news:AA******** *************** ***********@mic rosoft.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>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
Nov 13 '07 #3

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

Similar topics

5
4820
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 threads to finish. The threads are asynchronous, correct? And I thought each would be able to use it's own version of the web service. Am I wrong, does the web service force only one thread at a time to execute? Here is code if interested... I'm...
8
3009
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
3315
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 a windows form. When I try to hook up the webservice to the event and call the WS, the CPU goes to 100% and I have to restart the WWW service. Does anyone have an idea as to how this can be done ... and if not, directions to a tall bridge would...
4
2329
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 AsyncCallback(TrsWebSvsCallback); IAsyncResult ar = webSrv.BeginProcessCall( 1, cb, transWeb40); while (ar.IsCompleted == false)
5
4369
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 i can get this answer.. Thanks
0
1620
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 using asynchronous webservices calls. The number of webservices called concurrent is between 1 and 18. The webservice calls are made using SSL with a X509 clientcertificate. The application is underhigh load
1
1927
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 something wrong with the code that I have below. Thanks.. The following are my two methods where one is calling web service and
10
2182
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 parameters before the callback method is called. Any ideas of how to do this or if it even matters? I did not know if calling the asynch process a new time kills the previous one or not. Thank you for your help. Susan
0
1381
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 found two solutions but I can't figure out which one is better? 1. Asynchronous OneWay WebService: - Declare a OneWay method for the long task inside an asmx file in my website and WebReference it.
0
8444
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8869
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.