Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetSDMX_WSRest"/> class.
        /// </summary>
        /// <param name="config">
        /// The config
        /// </param>
        public GetSDMX_WSRest(EndpointSettings config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(config.EndPoint))
            {
                throw new ArgumentException(Resources.ExceptionEndpointNotSet, "config");
            }

            // Getting nsiClientWs
            EndpointSettings V20Sett = (EndpointSettings)config.Clone();

            V20Sett.EndPointType = "V20";
            V20Sett.EndPoint     = V20Sett.EndPointV20;
            this._nsiClientWs    = new GetSDMX_WSV20(V20Sett);

            Logger.Info(Resources.InfoCreatingNsiClient);
            this._config = config;

            this._defaultHeader = new HeaderImpl("NSIClient", "NSIClient");
            Utils.PopulateHeaderFromSettings(this._defaultHeader);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GetSDMX_WSV20"/> class.
        /// </summary>
        /// <param name="config">
        /// The config
        /// </param>
        public GetSDMX_WSV21(EndpointSettings config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(config.EndPoint))
            {
                throw new ArgumentException(Resources.ExceptionEndpointNotSet, "config");
            }

            //getting nsiClientWs
            EndpointSettings V20Sett = (EndpointSettings)config.Clone();

            V20Sett.EndPointType = "V20";
            V20Sett.EndPoint     = V20Sett.EndPointV20;
            _nsiClientWs         = new GetSDMX_WSV20(V20Sett);

            Logger.Info(Resources.InfoCreatingNsiClient);
            _config = config;
            Logger.Info(Resources.InfoGetWSDL);
            try
            {
                this._wsdlConfig = new WSDLSettings(config);
                Logger.Info(Resources.InfoWSDLSuccess);
            }
            catch (WebException ex)
            {
                throw NsiClientHelper.HandleWsdlException(config.EndPoint, ex, config.Wsdl);
            }
            catch (InvalidOperationException ex)
            {
                throw NsiClientHelper.HandleWsdlException(config.EndPoint, ex, config.Wsdl);
            }
            catch (UriFormatException ex)
            {
                throw NsiClientHelper.HandleWsdlException(config.EndPoint, ex, config.Wsdl);
            }

            this._defaultHeader = new HeaderImpl("NSIClient", "NSIClient");
            Utils.PopulateHeaderFromSettings(this._defaultHeader);
        }
        public static IGetSDMX GetSdmxImplementation(EndpointSettings endpoint)
        {
            IGetSDMX obj = null;
            try
            {
                switch (endpoint._TypeEndpoint)
                {
                    case ISTAT.WebClient.WidgetComplements.Model.Enum.EndpointType.V20:
                        obj = new GetSDMX_WSV20(endpoint);
                        break;
                    case ISTAT.WebClient.WidgetComplements.Model.Enum.EndpointType.V21:
                        obj = new GetSDMX_WSV21(endpoint);
                        break;
                    case ISTAT.WebClient.WidgetComplements.Model.Enum.EndpointType.REST:
                        obj = new GetSDMX_WSRest(endpoint);
                        break;
                }
            }
            catch { }

            return obj;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetSDMX_WSV20"/> class. 
        /// </summary>
        /// <param name="config">
        /// The config
        /// </param>
        public GetSDMX_WSV21(EndpointSettings config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(config.EndPoint))
            {
                throw new ArgumentException(Resources.ExceptionEndpointNotSet, "config");
            }

            //getting nsiClientWs
            EndpointSettings V20Sett = (EndpointSettings)config.Clone();
            V20Sett.EndPointType = "V20";
            V20Sett.EndPoint = V20Sett.EndPointV20;
            _nsiClientWs = new GetSDMX_WSV20(V20Sett);

            Logger.Info(Resources.InfoCreatingNsiClient);
            _config = config;
            Logger.Info(Resources.InfoGetWSDL);
            try
            {
                this._wsdlConfig = new WSDLSettings(config);
                Logger.Info(Resources.InfoWSDLSuccess);
            }
            catch (WebException ex)
            {
                throw NsiClientHelper.HandleWsdlException(config.EndPoint, ex, config.Wsdl);
            }
            catch (InvalidOperationException ex)
            {
                throw NsiClientHelper.HandleWsdlException(config.EndPoint, ex, config.Wsdl);
            }
            catch (UriFormatException ex)
            {
                throw NsiClientHelper.HandleWsdlException(config.EndPoint, ex, config.Wsdl);
            }

            this._defaultHeader = new HeaderImpl("NSIClient", "NSIClient");
            Utils.PopulateHeaderFromSettings(this._defaultHeader);
        }