Solved

How to check the availability of a web service before calling it. C#

Posted on 2007-03-23
7
305 Views
Last Modified: 2013-12-17
Hi,

I would like to check the availability of a web service before calling it through c#. Sort of like a ping.

How would I accomplish this.
0
Comment
Question by:terrorbyte
  • 4
7 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 18779059
you could use system.net.webrequest / webresponse and check to see if the getresponse method returns null
0
 

Author Comment

by:terrorbyte
ID: 18779299
Hi p davis,
how exactly would i do that?
0
 
LVL 22

Accepted Solution

by:
p_davis earned 500 total points
ID: 18780383
WebRequest myRequest = WebRequest.Create(site);
            WebResponse myResponse = myRequest.GetResponse();

where site is the url
0
 
LVL 22

Expert Comment

by:p_davis
ID: 18781250
also instead of checking for null you would probably want to do some exception handling with a try block
0
 
LVL 22

Expert Comment

by:p_davis
ID: 18977206
did you get it figured?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question