You can get the layer name from IMapLayerInfo.getName().
IMapServer ms=(IMapServer)this.soHelper.getServerObject();
IMapServerInfo mapServerInfo = ms.getServerInfo(ms.getDefaultMapName());
IMapLayerInfos layerInfos = mapServerInfo.getMapLayerInfos();
Loop through the IMapLayerInfos and you can find each layer's layer ID (IMapLayerInfo.getID()) and layer name (IMapLayerInfo.getName()). Based on the ID-Name pairs, you can return the layer name given the ID/index from the resourceName for each request.