smriti Posted April 18, 2008 Posted April 18, 2008 Hi, I need to write a program to check whether a webservice is up or not? The program should take the service as input and determine whether the webservice is up or not? Can you suggest me some ideas. Thanks, smriti Quote
davearia Posted April 18, 2008 Posted April 18, 2008 I'm not sure what you mean. Why not write a web service that returns a value and call this in your windows service periodically. Quote
mike55 Posted May 20, 2008 Posted May 20, 2008 Create a windows service, that calls a web method every few minutes using the http request and http response methods. I had to do this before to keep an eye on another web service and database. If I didn't get a reply, I waited for 1 minute and retried to call the web service and incremented my failed response counter from 0 to 1. If still no reply, I waited for 1 more minute and retried. If on the third attempt I got no reply, I auto-generated a SMS message and sent it to a number of support personnel. If however, I got a valid reply I used to reset my failed response counter to 0. I used to call the web service 3 times just to cover my self, the first time it failed may be down to a delay in replying/slow connection etc. and I didn't want to be sending out SMS messages and annoying people. I'll try and dig out some code for you if I get a chance. Mike55. Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
Nate Bross Posted May 20, 2008 Posted May 20, 2008 Untested, but something like this should work. System.Net.HttpWebRequest client = (HttpWebRequest)System.Net.WebRequest.Create("http://www.yoursite.com/service.asmx/"); client.Timeout = 60000; System.IO.Stream strm = client.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(strm); string line; do { line = sr.ReadLine(); listbox1.Items.Add(line); } while (line != null); strm.Close(); Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.