public MessagingClient()
        {
            System.Collections.Specialized.NameValueCollection appSettings =
                ConfigurationManager.AppSettings;

            if (!appSettings.HasKeys()) {
                throw new ConfigurationErrorsException("No app.settings options found.");
            }

            string accountId = appSettings.Get("SoftLayer.Messaging.AccountID");
            string userName = appSettings.Get("SoftLayer.Messaging.UserName");
            string apiKey = appSettings.Get("SoftLayer.Messaging.APIKey");
            this.dataCenter = appSettings.Get("SoftLayer.Messaging.DataCenter");
            bool usePrivateEndpoint = false;

            try {
                usePrivateEndpoint = Convert.ToBoolean(
                    appSettings.Get("SoftLayer.Messaging.PrivateEndpoint"));
            }
            catch (FormatException e) {
                throw new FormatException("PrivateEndpoint must be either true or false.", e);
            }

            this.endpointConfig = new EndpointConfig();
            this.endpointConfig.Load();

            this.client = new MessagingApi(accountId, userName, apiKey,
                endpointConfig.GetUrlForDatacenter(this.dataCenter, usePrivateEndpoint));
        }
        public MessagingClient(string accountId, string userName, string apiKey, string dataCenter, bool usePrivateEndpoint = false)
        {
            EndpointConfig endpointConfig = new EndpointConfig();
            endpointConfig.Load();
            string apiEndpoint = endpointConfig.GetUrlForDatacenter(dataCenter, usePrivateEndpoint);

            this.client = new MessagingApi(accountId, userName, apiKey, apiEndpoint);
            this.UsePrivateEndpoint = usePrivateEndpoint;
            this.dataCenter = dataCenter;
        }