Example #1
0
        public bool Connect(string userName, string passWord) {
            try {
                CredentialCache credCache = new CredentialCache();
                credCache.Add(host, "Basic", new NetworkCredential(userName, passWord));

                // Ligação à API-A
                service = new FedoraAPIAService();
                service.Url = host.ToString() + "/services/access";
                service.Timeout = 240000;
                service.PreAuthenticate = true;
                service.Credentials = credCache;

                // Ligação à API-M
                manager = new FedoraAPIMService();
                manager.Url = host.ToString() + "/services/management";
                manager.Timeout = 120000;
                manager.PreAuthenticate = true;
                manager.Credentials = credCache;

                serverNamespace = service.describeRepository().repositoryPIDNamespace;
                return true; 
            }  catch (Exception ex) {
                Trace.WriteLine(ex.ToString());
                return false; 
            }
        }
Example #2
0
        public bool Connect(string userName, string passWord)
        {
            try {
                CredentialCache credCache = new CredentialCache();
                credCache.Add(host, "Basic", new NetworkCredential(userName, passWord));

                // Ligação à API-A
                service                 = new FedoraAPIAService();
                service.Url             = host.ToString() + "/services/access";
                service.Timeout         = 240000;
                service.PreAuthenticate = true;
                service.Credentials     = credCache;

                // Ligação à API-M
                manager                 = new FedoraAPIMService();
                manager.Url             = host.ToString() + "/services/management";
                manager.Timeout         = 120000;
                manager.PreAuthenticate = true;
                manager.Credentials     = credCache;

                serverNamespace = service.describeRepository().repositoryPIDNamespace;
                return(true);
            }  catch (Exception ex) {
                Trace.WriteLine(ex.ToString());
                return(false);
            }
        }