Exemplo n.º 1
0
        public List <MapService> Services(string user, string password)
        {
            List <MapService> services = new List <MapService>();
            DateTime          td       = DateTime.Now;

            string axl = String.Empty;

            using (MapServerInstanceTypeService service = new MapServerInstanceTypeService(_url))
            {
                axl = service.ServiceRequest("catalog", "<GETCLIENTSERVICES/>", "BB294D9C-A184-4129-9555-398AA70284BC",
                                             user,
                                             password);
            }

            TimeSpan ts       = DateTime.Now - td;
            int      millisec = ts.Milliseconds;

            if (axl == "")
            {
                return(services);
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(axl);
            foreach (XmlNode mapService in doc.SelectNodes("//SERVICE[@name]"))
            {
                MapService.MapServiceType type = MapService.MapServiceType.MXL;
                if (mapService.Attributes["servicetype"] != null)
                {
                    switch (mapService.Attributes["servicetype"].Value.ToLower())
                    {
                    case "mxl":
                        type = MapService.MapServiceType.MXL;
                        break;

                    case "svc":
                        type = MapService.MapServiceType.SVC;
                        break;

                    case "gdi":
                        type = MapService.MapServiceType.GDI;
                        break;
                    }
                }
                services.Add(new MapService(mapService.Attributes["name"].Value, type));
            }
            return(services);
        }
Exemplo n.º 2
0
        public List <MapService> Services(string user, string password)
        {
            List <MapService> services = new List <MapService>();
            DateTime          td       = DateTime.Now;

            string axl = String.Empty;

            axl = WebFunctions.HttpSendRequest(_url + "/catalog", "POST",
                                               Encoding.UTF8.GetBytes("<GETCLIENTSERVICES/>"), user, password, this.Timeout * 1000);

            TimeSpan ts       = DateTime.Now - td;
            int      millisec = ts.Milliseconds;

            if (axl == "")
            {
                return(services);
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(axl);
            foreach (XmlNode mapService in doc.SelectNodes("//SERVICE[@name]"))
            {
                MapService.MapServiceType type = MapService.MapServiceType.MXL;
                if (mapService.Attributes["servicetype"] != null)
                {
                    switch (mapService.Attributes["servicetype"].Value.ToLower())
                    {
                    case "mxl":
                        type = MapService.MapServiceType.MXL;
                        break;

                    case "svc":
                        type = MapService.MapServiceType.SVC;
                        break;

                    case "gdi":
                        type = MapService.MapServiceType.GDI;
                        break;
                    }
                }
                services.Add(new MapService(mapService.Attributes["name"].Value, type));
            }
            return(services);
        }