Checking if a webservice is running
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Checking if a webservice is running

  1. #1
    Join Date
    Jun 2001
    Location
    Denmark
    Posts
    448

    Question 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.

  2. #2
    Join Date
    Jul 2012
    Posts
    90

    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).

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,370

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center