[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Determine if a WebService is running?

Posted on 2005-05-09
6
Medium Priority
?
225 Views
Last Modified: 2010-04-01
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;
    }
}
0
Comment
Question by:TYB
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 13959326
You can just try to see whether the webservice location is accessible (e.g. by browsing) http://www.myserver.com/webservice_location/mypage.asmx
0
 
LVL 86

Expert Comment

by:jkr
ID: 13959944
>>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'.
0
 

Author Comment

by:TYB
ID: 13966543
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?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Accepted Solution

by:
nonubik earned 750 total points
ID: 13966573
>The browsing idea can´t be used... I want to do this programatically.

Really?
What about InternetOpen and InternetOpenURL from wininet?
0
 

Author Comment

by:TYB
ID: 13966595
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...
0
 

Author Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

830 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