public FedoraAccessSOAPImpl(FedoraServer fedoraServer)
        {
            if ((fedoraServer.ServerAddress.Length <= 0) || (fedoraServer.ServerAddress.Length <= 0)) {
               Console.Write("Server not set....");
            }
            else
            {
                string fedoraAccessServiceURL = "http://" + fedoraServer.ServerAddress + ":" + fedoraServer.ServerPort + "/fedora/services/access";
                fedoraAccessProxy = new FedoraAPIAClient("access", fedoraAccessServiceURL);

                var defaultCredentials = fedoraAccessProxy.Endpoint.Behaviors.Find<ClientCredentials>();
                var loginCredentials = new ClientCredentials();
                loginCredentials.UserName.UserName = fedoraServer.AdminUsername;
                loginCredentials.UserName.Password = fedoraServer.AdminPassword;

                fedoraAccessProxy.Endpoint.Behaviors.Remove(defaultCredentials);
                fedoraAccessProxy.Endpoint.Behaviors.Add(loginCredentials);

            }
        }
        private string QueryIndex(string type, string lang, string format, string limit, string query)
        {
            fedoraServer = new FedoraServer();

            string resourceIndexURIString = "http://" + fedoraServer.ServerAddress + ":" + fedoraServer.ServerPort.ToString() + "/fedora/risearch";
            Uri resourceIndexURI = new Uri(resourceIndexURIString);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(resourceIndexURI);

            Dictionary<string,string> postVariables  = new Dictionary<string,string>();
            postVariables.Add("type", type);
            postVariables.Add("lang", lang);
            postVariables.Add("format", format);
            postVariables.Add("limit", limit);
            postVariables.Add("query", query);

            string postString = dictionaryToPostString(postVariables);
            byte[] postBytes  = Encoding.ASCII.GetBytes(postString);

            request.Method = "POST";
            request.ContentLength = postBytes.Length;
            request.AllowAutoRedirect = true;
            request.ContentType = "application/x-www-form-urlencoded";

            Stream postStream = request.GetRequestStream();
            postStream.Write(postBytes,0,postBytes.Length);
            postStream.Close();

            HttpWebResponse response = (HttpWebResponse) request.GetResponse();
            //WebResponse response = request.GetResponse();

            Stream responseStream = response.GetResponseStream();
            StreamReader responseStreamReader = new StreamReader(responseStream);

            string result = responseStreamReader.ReadToEnd();

            response.Close();
            responseStream.Close();
            responseStreamReader.Close();

            return result;
        }
 //--------------------------------------------------//
 public HydraServiceFedoraImpl()
 {
     _fedoraServer = new FedoraServer();
     this._objectPID = string.Empty;
 }