-
September 14th, 2012, 02:47 AM
#1
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.
-
September 14th, 2012, 02:06 PM
#2
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).
-
September 16th, 2012, 05:18 PM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|