Make use of GeoXmlService to obtain layer objects instead of $http
service with hardcoded /api/melfin path. Behaviour unchanged.