Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • 1 month later...
Posted

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.

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)

Posted

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();

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...