shrirang

Hi,

I access a webservice from a Windows CE 5.0 device. I call a published method (over WLAN) and display the output in the Windows Form (.NET 2.0).

Before I call the method, I check if the device is getting signal from an access point. Now the problem is that even if my device says that it is getting good signal from AP, it does not mean that the webservice is available or reachable. In this case the method call runs into time-out throwing a webexception.

Now the question: Is there a way I can check before calling the web service if it can be reached

Cheers,
sm


Re: Smart Devices General Check availability of a web service

Ilya Tumanov

I suppose you can try WebRequst to the server and see if you got a replay. It's pretty much the same as simply connecting to it though.

I would go with simple connection attempt done asynchronously so UI wonĄŻt be blocked with appropriate error handling to report WS is not accessible.






Re: Smart Devices General Check availability of a web service

ScubaSteve20001

I think you pretty much answered your own question. When the web service can't be reached it will throw a webexception. If that occurs then you know that it is unreachable. If the problem is that you are doing a lot of preprocessing before calling the web service and that you don't want to waste time doing this if you don't have a connection, then you could just add to the same web service some small function that returns a boolean value or anything simple that you can call to verify that you have a connection to the web service before your call to this other more expensive operation. Then as the person above mentioned, you can do all of this asynchronously (using the Begin... and End... web method name functions of your service class) so that you are not locking up the GUI when you are calling the web service.