udbk

Service status

Discussion created by udbk on Nov 16, 2012
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

Outcomes