map.removeAllLayers() doesnot remove mapservices

Discussion created by Sowjanya on Apr 4, 2012
Latest reply on Apr 10, 2012 by svakil-esristaff
Has anyone successfully removed a mapservice using map.removeAllLayers()?
I'm using version 2.7 of the API and have also tried the code below to remove mapservices.

        for (var j = 0; j < map.layerIds.length; j++) {
            var layer = map.getLayer(map.layerIds[j]);


but none of these remove the mapservices. Any help is appreciated.