/// <summary>
        /// Constructor
        /// </summary>
        public WsInfo(NSIClientSettings config, SdmxSchemaEnumType schemaVersion)
        {
            _config        = config;
            _schemaVersion = schemaVersion;

            //endpointType
            bool endpointTypeOk = Enum.TryParse(_config.EndPointType, true, out _endpointType);

            if (!endpointTypeOk)
            {
                _endpointType = EndpointType.V20;
            }

            //endpoint, wsdl
            if (_schemaVersion == SdmxSchemaEnumType.VersionTwo)
            {
                if (_endpointType == EndpointType.V20 && _config.EndPoint != null)
                {
                    _endpoint = _config.EndPoint;
                    _wsdl     = _config.Wsdl;
                }
                else
                {
                    _endpoint = _config.EndPointV20;
                    _wsdl     = _config.WsdlV20;
                }
            }
            else
            {
                _endpoint = _config.EndPoint;
                _wsdl     = _config.Wsdl;
            }
        }
        /// <summary>
        /// Gets the current applications &lt;NSIClient&gt; section.
        /// </summary>
        /// <param name="configLevel">
        /// The &lt;ConfigurationUserLevel&gt; that the config file
        /// is retrieved from.
        /// </param>
        /// <returns>
        /// The configuration file's &lt;NSIClient&gt; section.
        /// </returns>
        public static NSIClientSettings GetSection(ConfigurationUserLevel configLevel)
        {
            /*
             * This class is setup using a factory pattern that forces you to
             * name the section &lt;NSIClient&gt; in the config file.
             * If you would prefer to be able to specify the name of the section,
             * then remove this method and mark the constructor public.
             */
            Configuration     config         = null;
            HttpContext       ctx            = HttpContext.Current;
            NSIClientSettings clientSettings = null;

            if (ctx != null)
            {
                string virtualPath = ctx.Request.ApplicationPath;

                try
                {
                    config = WebConfigurationManager.OpenWebConfiguration(virtualPath);
                }
                catch (ConfigurationErrorsException ex)
                {
                    string message = Resources.ExceptionReadingConfiguration + ex.Message;
                    if (virtualPath != null)
                    {
                        message = string.Format(
                            CultureInfo.InvariantCulture,
                            Resources.InfoWebConfigLocation,
                            message,
                            ctx.Server.MapPath(virtualPath));
                    }

                    Console.WriteLine(ex.ToString());
                    Console.WriteLine(message);
                    try
                    {
                        var map = new WebConfigurationFileMap();
                        var vd  = new VirtualDirectoryMapping(ctx.Server.MapPath(virtualPath), true);

                        map.VirtualDirectories.Add(virtualPath, vd);
                        config = WebConfigurationManager.OpenMappedWebConfiguration(map, virtualPath);
                    }
                    catch (ConfigurationException e)
                    {
                        Console.WriteLine(e.ToString());

                        // read-only..
                        clientSettings =
                            (NSIClientSettings)
                            WebConfigurationManager.GetWebApplicationSection(typeof(NSIClientSettings).Name);
                    }

                    // throw new NSIClientException(message, ex);
                }
            }
            else
            {
                config = ConfigurationManager.OpenExeConfiguration(configLevel);
            }

            if (config != null)
            {
                clientSettings = (NSIClientSettings)config.GetSection("NSIClientSettings");
                if (clientSettings == null)
                {
                    clientSettings = new NSIClientSettings();
                    config.Sections.Add("NSIClientSettings", clientSettings);
                }

                clientSettings._config = config;
            }
            else
            {
                if (clientSettings == null)
                {
                    throw new NsiClientException("Missing NSIClientSettings. Cannot add NSIClientSettings settings");
                }
            }

            return(clientSettings);
        }