Checking if a webservice is running
I need to check if a webservice is running. I do not know anything about it, other than the URL. Can I - at runtime - take the URL, get one of the methods (doesn't matter which one), call it, and then receive either an answer or an error? All I need to know is, that there is "someone" out there, not whether I get a correct response or whatever.
The URL and thus the webserice I need to check will be different each time, so there can be no service references in the project.
Re: Checking if a webservice is running
Since you don't have any knowledge of the web service other than the URL, the only thing that you can reasonably expect to check is that the web server is up and allowing connections to that URL.
string URL = "web service's URL";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
If this does not throw a WebException, the connection was sucessful.
You can't rely on the web service's methods because you don't know what they are (not all web services support discovery - publish a WSDL).
Re: Checking if a webservice is running
Keep in mind that just because you can connect with a HttpWebRequest, doesn't mean that the web service's methods are working.