473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

WebService and timeout

Hi.

I'm dealing with scenario when call to any web method ends up with timeout
and I try to add the user a chance to retry (wait a little bit)
My service proxy code looks like this:

AsyncCallback cb = new AsyncCallback(ServiceCallback);
IAsyncResult result1 = BeginInvoke(methodName, parameters, cb, this);
if(result1.IsCompleted == false)
{
while(true)
{
bTO = result1.AsyncWaitHandle.WaitOne(Timeout, true);
if(bTO == false)//time out occured
{
//display window and ask the user to wait a moment, user press
OK when it sure that web method finished
}
if(result1.IsCompleted)
break;
}
object[] ret = EndInvoke(result1);// error every time when time out
occured (bTO = false)
}
My scenario is following:
1. BeginInvoke initialize asynch web method call
2. WaitOne waits for Timeout miliseconds
3. WaitOne returns false because timeout occured, and wait screen is
displayed. When user close it the web methos is finished.
4. result1.IsCompleted is true so I expect that EndInvoke shall return the
results but it throws excpetion "timeout" !!!. Why?
Everything works fine if timeout doesn't occure.

Thanks for any advise
Shark

Jun 27 '08 #1
2 3441
Have you tried calling this synchronously? If it is going to time out and
you need to get your results before you can go any further, calling it
asynchronously isn't going to help any.
Peter
"shark" <ma**@poczta.onet.plwrote in message
news:fv**********@news.onet.pl...
Hi.

I'm dealing with scenario when call to any web method ends up with timeout
and I try to add the user a chance to retry (wait a little bit)
My service proxy code looks like this:

AsyncCallback cb = new AsyncCallback(ServiceCallback);
IAsyncResult result1 = BeginInvoke(methodName, parameters, cb, this);
if(result1.IsCompleted == false)
{
while(true)
{
bTO = result1.AsyncWaitHandle.WaitOne(Timeout, true);
if(bTO == false)//time out occured
{
//display window and ask the user to wait a moment, user press
OK when it sure that web method finished
}
if(result1.IsCompleted)
break;
}
object[] ret = EndInvoke(result1);// error every time when time out
occured (bTO = false)
}
My scenario is following:
1. BeginInvoke initialize asynch web method call
2. WaitOne waits for Timeout miliseconds
3. WaitOne returns false because timeout occured, and wait screen is
displayed. When user close it the web methos is finished.
4. result1.IsCompleted is true so I expect that EndInvoke shall return the
results but it throws excpetion "timeout" !!!. Why?
Everything works fine if timeout doesn't occure.

Thanks for any advise
Shark
Jun 27 '08 #2
Yes, synchronously it works fine, but I try to get the user a possibility to
wait longer than 'timeout'.
My scenario shall looks:
1. Init asynchronously call
2. Wait for results
3. If timeout goto 2 else if IsCompleted goto 3
4. Call EndInvoke to get the results.

It seems that calling EndInvoke in case earlier timeout occured ends up with
TimeOut exception. Why?

Thx


"Peter Bromberg [C# MVP]" <pb*******@nospammin.yahoo.comwrote in message
news:47**********************************@microsof t.com...
Have you tried calling this synchronously? If it is going to time out and
you need to get your results before you can go any further, calling it
asynchronously isn't going to help any.
Peter
"shark" <ma**@poczta.onet.plwrote in message
news:fv**********@news.onet.pl...
>Hi.

I'm dealing with scenario when call to any web method ends up with
timeout and I try to add the user a chance to retry (wait a little bit)
My service proxy code looks like this:

AsyncCallback cb = new AsyncCallback(ServiceCallback);
IAsyncResult result1 = BeginInvoke(methodName, parameters, cb, this);
if(result1.IsCompleted == false)
{
while(true)
{
bTO = result1.AsyncWaitHandle.WaitOne(Timeout, true);
if(bTO == false)//time out occured
{
//display window and ask the user to wait a moment, user press
OK when it sure that web method finished
}
if(result1.IsCompleted)
break;
}
object[] ret = EndInvoke(result1);// error every time when time out
occured (bTO = false)
}
My scenario is following:
1. BeginInvoke initialize asynch web method call
2. WaitOne waits for Timeout miliseconds
3. WaitOne returns false because timeout occured, and wait screen is
displayed. When user close it the web methos is finished.
4. result1.IsCompleted is true so I expect that EndInvoke shall return
the results but it throws excpetion "timeout" !!!. Why?
Everything works fine if timeout doesn't occure.

Thanks for any advise
Shark
Jun 27 '08 #3

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

Similar topics

1
by: Jack Wright | last post by:
Dear All, I have observed that if I call a synchronous WebService from my aspx page then even if I set oProxy.TimeOut = 1000, the WebService thread execution is still running... Since my...
1
by: Vai2000 | last post by:
Hi All, What's the difference between Timeout on the Webservice proxy object and Timeout on the auto generated Proxy // foo.aspx.cs localhost.MyWebSvc svc=new localhost.MyWebSvc();...
0
by: Steve Schaenzer | last post by:
Hello, I have a windows client that makes a WebService call on regular intervals using a timer. This call is very simple and always takes a very short time to reply. However about every one in...
2
by: wcchan | last post by:
Hi, We set debug="false" at web.config of a WebService for performance sake. We found that after set, the web service request will sometimes got a timeout exception. Would anyone tell me how long...
7
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
7
by: Robbert van Geldrop | last post by:
Hello, I have a problem in a C# client that consumes a webservice which is wrapped by WSE 2.0 sp3: The WebService works fine but very rarely my client comes in a state where every call to the...
0
by: Dmitry Markin | last post by:
I've met one strange occurence with webservices - I use webservice as a server and win32 application as a client, after some time of usage any call to webservice results into a timeout... seems...
1
by: intrepid_dw | last post by:
All: I have prepared a .NET 1.1 client application that consumes a remote, public web service. All the functions work as expected, and, in general, the application has been successful for my...
4
by: =?Utf-8?B?c2FtZWVy?= | last post by:
environment : .net framework 1.1, ado.net, visual studio 2003, vb, sqlsever 2000, winforms, webforms I want to increase the timout of the webservice in the application which is being used in a...
4
by: Simon | last post by:
I would like to know how to set the timeout for System.Web.Services.WebService class (from which my web service is derived)? According to documentation there should be Timeout property, but I can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.