Select to view content in your preferred language

Check MapService Availability

734
1
10-03-2012 11:56 PM
demdeberanz
Emerging Contributor
Hi guys,
   before to start the user processing on the map in a web application, i.e. loading panels, features, connecting events, etc..., I would like to check if the mapService used within the application is available and working. What I want is to set up an error handling procedure.
How to do this?Is there a specific function or attribute or request in the API to do this?

Thank you very much.
0 Kudos
1 Reply
Krystianp
Deactivated User
when you creates an object for layer, you can use build-in method onError - its tests if service is avaliable

for example:
var baseMap = new esri.layers.ArcGISDynamicMapServiceLayer('http://youservice', {
 id : 'layerBaseMap'
});
baseMap.onError = function(error) {
 console.log(error);
};


EDIT:
but it only launch when the service link is correct link to your arcgis server. If you add wrong address to whole arcgis server it will NOT fires up.
0 Kudos