|
-
March 20th, 2003, 07:25 AM
#1
Calling Webservice Method from a timer method
I have created a timer.
TimerCallback timerDelegate = new TimerCallback(MyCallBack);
Timer timer = new Timer(timerDelegate,num,1000, 1000);
Simply call MyCallBack function after every second
Now in MyCallBack I just call the HelloWorld function of a simple webservice and displays that value in a listbox
void Inform(Object state)
{
m_lb.Items.Add(s.HelloWorld());
}
The funny thing is that this works only 19 times ...the string Hello is displayed only 19 times after which is stops....
WHY????????????
-
March 20th, 2003, 03:49 PM
#2
is the webservice getting stoped ? did you checked that ?
- Software Architect
-
March 20th, 2003, 11:24 PM
#3
I have put a timeout value for the webservice and a exception is thrown in case the server is down......
But in this case no exception is called.....meaning the webservice is running...
IT JUST DOES'NT MAKES SENSE
-
March 21st, 2003, 01:34 PM
#4
do you saw the log which it generated,
create a log,
may be its going in recursion where somethign is going wrong
debug it check it out.
Paresh
- Software Architect
-
March 23rd, 2003, 11:02 PM
#5
Nope...I don't think thats teh problem.....
Some time back another person posted the same problem
http://www.codeguru.com/forum/showth...ighlight=Timer
No solution here as well.
-
March 24th, 2003, 01:19 AM
#6
the best option would be to use the Begin<MethodName> method on
the class you are using to call the web service. This will cause the web
service to be called on another thread, and you can give it a delegate that
will be called when the result has been obtained. This should keep your app
responsive. Just remember that when the method is called through the
delegate, that it might be (I would think most likely) called on another
thread other than the UI thread, so you should take that into account if
your callback function makes calls to the UI (like to a Refresh method).
-Paresh
- Software Architect
-
March 27th, 2003, 11:04 PM
#7
A Solution
Instead of using System.Threading.Timer timer mathod I used
System.Timers.Timer timer method.
Its working like its suppose to.
-
March 28th, 2003, 04:50 PM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|