Select to view content in your preferred language

Check REST Service Connectivity Before Adding To Map

841
1
10-25-2011 02:07 PM
BobbyRadakovich
Deactivated User
We are using various TOC components in Silverlight map viewers but one issue seems to baffle them all - what to do if the user running the silverlight app doesn't have connectivity to the REST url of one or more of the TOC entries?

Specifically, we define the entries in the TOC for a given map view using a web service - the Silverlight app calls the web service to find out what REST services to display, then we add these to the Map component and tell the TOC to refresh.  Any given user may be connected to the internal network directly, or connected to the internal network via VPN, or just connected to the Internet.  If a map includes a REST service that is only accessible on the internal network, then the map loads fine from the internal network or a VPN connection, but when one tries to view the map with only an Internet connection the TOC entry never populates and the map never displays.

To resolve this I want to be able to check that the user can actually resolve and connect to each REST url before adding it to the map, so if you're outside the office you will see all of the public services and the private ones will just be skipped.

All of the System.Net classes in Silverlight are constrained from doing any thing useful, and trying to check this asynchronously using a WebRequest will unnecessarily delay and possibly break the loading sequence.

Is there a simple way to do a direct, synchronous check to see if the REST service is accessible?
0 Kudos
1 Reply
RichardWatson
Deactivated User
The only way to check if an HTTP endpoint is responding is to send it a request and wait for the response.  Do note that the endpoint can transition between being available and not available.

What we do is to mark services as either required or not.  If a required service is not available then we fail the application.  If a service which not required is not available then we simply log and eat the error.
0 Kudos