예제 #1
0
        public string Send(string OnlineResource, string service, string request, string InterpreterGUID, string user, string pwd, int timeout = 0)
        {
            try
            {
                //return _instance.ServiceRequest2(OnlineResource, service, request, InterpreterGUID, user, HashPassword(pwd));

                // .NET Remoting
                using (MapServerInstanceTypeService conn = new MapServerInstanceTypeService(_url))
                {
                    if (timeout > 0)
                    {
                        conn.Timeout = timeout * 1000;
                    }
                    return(conn.ServiceRequest2(OnlineResource, service, request, InterpreterGUID, user, HashPassword(pwd)));
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                return("ERROR:" + ex.Message);
            }
        }
예제 #2
0
 public string Ping()
 {
     using (MapServerInstanceTypeService conn = new MapServerInstanceTypeService(_url))
     {
         conn.Timeout = 5000;
         return(conn.Ping());
     }
 }
예제 #3
0
 public bool UploadMetadata(string service, string metadata, string user, string password)
 {
     try
     {
         using (MapServerInstanceTypeService conn = new MapServerInstanceTypeService(_url))
             return(conn.SetMetadata(service, metadata, user, HashPassword(password)));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #4
0
 public string QueryMetadata(string service, string user, string password)
 {
     try
     {
         using (MapServerInstanceTypeService conn = new MapServerInstanceTypeService(_url))
             return(conn.GetMetadata(service, user, HashPassword(password)));
     }
     catch (Exception ex)
     {
         return("ERROR:" + ex.Message);
     }
 }
예제 #5
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);
        }
예제 #6
0
 public bool RemoveMap(string name, string usr, string pwd)
 {
     using (MapServerInstanceTypeService conn = new MapServerInstanceTypeService(_url))
         return(conn.RemoveMap(name, usr, HashPassword(pwd)));
 }