Service status

467
0
11-16-2012 11:52 PM
Udaya_BhaskerCheerala
New Contributor
Hi All,

I need to get Map Service status weather it is started or stopped, so I can show some alert to user if service is stopped.

with the below code Iam able to get weather service exists or not, but I need to get the status of it.

dojo.require("esri.utils");
        var input, err;

        dojo.addOnLoad(function () {            
            getStatus('http://myserver/WSIPL/rest/services/Newservice/MapServer');
        });

        function getStatus(url) {
          
            esri.request({
                url: url,
                content: { f: "json" },
                callbackParamName: "callback",
                load: loadCallback,
                error: errorCallback,
                timeout: 1000
            });
        }

        function loadCallback(response, io) {
                    alert('Sucess.');
        }

        function errorCallback(response, io) {           
            if (response.message) {
                               alert('GIS is not available.');
            }
            else if (response.error) {

                                alert('GIS is not available.');
            }
        }


Thanks,
Uday
0 Kudos
0 Replies