Link to home
Start Free TrialLog in
Avatar of TYB
TYB

asked on

Determine if a WebService is running?

Hi everyone!

I have an application that should call an webservice that can reside on any computer in my network. I use the SetUrl() to set the acutal location of the Webservice but as I don´t know which URL the WebService resides on I would like to have a couple of different URL:s to choose from. Now I´m wondering if it´s possible to determine if a WebService is running without making an actual call to one of the interfaces? Something like this:

MyWebService* GetWebService()
{
   bool bIsRunning = false;
   while( bIsRunning == false )
   {
        MyWebService* pService = new MyWebService();
        pService->SetUrl(strURL);
   
        // Check if WebService is running????
        bool bIsRunning = pService->IsRunning();             < ----- THIS IS WHAT I NEED HELP WITH
        if( bIsRunning )
            return pService;
    }
}
Avatar of nonubik
nonubik

You can just try to see whether the webservice location is accessible (e.g. by browsing) http://www.myserver.com/webservice_location/mypage.asmx
Avatar of jkr
>>I use the SetUrl() to set the acutal location of the Webservice

'SetUrl()' returns a HRESULT code - if it fails (i.e. because there is no service) you should receive an error code instead of 'S_OK'.
Avatar of TYB

ASKER

The browsing idea can´t be used... I want to do this programatically.

But I tested the SetUrl() resultcode and it returns S_OK even if I try to set the URL to a WebService that doesn´t exists...strange!

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of nonubik
nonubik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TYB

ASKER

Ok.... by browsing I thought you meant the IE or something like that.

I´ll have a look at the InternetOpen and InternetOpenURL...tnx!

I´ll get back to you when I have tried it out...
Avatar of TYB

ASKER

I´m sorry for not accepting earlier... got a lot of other work to do. Tnx for your answer though...it solved my problem.