Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-23
7
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

705 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