Ejemplo n.º 1
0
        public FacadeRepository()
        {
            NameValueCollection settings  = ConfigurationManager.AppSettings;
            ServiceSettings     _settings = new ServiceSettings();

            _settings.AppendSettings(settings);

            #region initialize webHttpClient for converting old mapping
            string proxyHost = _settings["ProxyHost"];
            string proxyPort = _settings["ProxyPort"];

            string facadeServiceUri = _settings["FacadeServiceUri"];
            if (facadeServiceUri.EndsWith("/"))
            {
                facadeServiceUri = facadeServiceUri.Remove(facadeServiceUri.Length - 1);
            }

            if (!string.IsNullOrEmpty(proxyHost) && !string.IsNullOrEmpty(proxyPort))
            {
                WebProxy webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                _facadeServiceClient = new WebHttpClient(facadeServiceUri, null, webProxy);
            }
            else
            {
                _facadeServiceClient = new WebHttpClient(facadeServiceUri);
            }
            #endregion
        }
Ejemplo n.º 2
0
        protected WebHttpClient CreateWebClient(string baseUri)
        {
            WebHttpClient client = null;

            if (!String.IsNullOrEmpty(_proxyHost) && !String.IsNullOrEmpty(_proxyPort))
            {
                WebProxy webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                client = new WebHttpClient(baseUri, null, webProxy);
            }
            else
            {
                client = new WebHttpClient(baseUri);
            }

            if (AuthHeaders != null && AuthHeaders.Count > 0)
            {
                _logger.Debug("Injecting authorization [" + AuthHeaders.Count + "] headers.");
                client.Headers = AuthHeaders;
            }
            else
            {
                _logger.Debug("No authorization headers.");
            }

            return(client);
        }
Ejemplo n.º 3
0
        protected WebHttpClient CreateWebClient(string baseUri)
        {
            WebHttpClient client = null;

            if (!String.IsNullOrEmpty(_proxyHost) && !String.IsNullOrEmpty(_proxyPort))
            {
                var webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                client = new WebHttpClient(baseUri, null, webProxy);
            }
            else
            {
                client = new WebHttpClient(baseUri);
            }

            return(client);
        }
Ejemplo n.º 4
0
        public Program()
        {
            //Adapter Service does all this...
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            file = new System.IO.StreamWriter(_fileName);
            NameValueCollection appSettings = System.Configuration.ConfigurationManager.AppSettings;
            ServiceSettings     settings    = new ServiceSettings();

            settings.AppendSettings(appSettings);

            //This is how DataLayers should use settings...
            WebProxyCredentials webProxyCredentials = settings.GetWebProxyCredentials();

            _widgetServiceClient = new WebHttpClient(settings["WidgetServiceUri"],
                                                     webProxyCredentials.userName,
                                                     webProxyCredentials.password,
                                                     webProxyCredentials.domain,
                                                     webProxyCredentials.proxyHost,
                                                     webProxyCredentials.proxyPort);

            //In a DataLayer this is automatic and is not required
            _widgetServiceClient.AccessToken = settings["AccessToken"];
        }
Ejemplo n.º 5
0
        public RefDataRepository()
        {
            NameValueCollection settings  = ConfigurationManager.AppSettings;
            ServiceSettings     _settings = new ServiceSettings();

            _settings.AppendSettings(settings);

            #region initialize webHttpClient for converting old mapping
            string proxyHost = _settings["ProxyHost"];
            string proxyPort = _settings["ProxyPort"];
            string referenceDataServiceUri = _settings["RefDataServiceUri"];

            if (!String.IsNullOrEmpty(proxyHost) && !String.IsNullOrEmpty(proxyPort))
            {
                WebProxy webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                _referenceDataServiceClient = new WebHttpClient(referenceDataServiceUri, null, webProxy);
            }
            else
            {
                _referenceDataServiceClient = new WebHttpClient(referenceDataServiceUri);
            }
            #endregion
        }