/// <summary>
 /// Log the SDMX-ML message stored in the stream.
 /// </summary>
 /// <param name="config">
 /// The config
 /// </param>
 /// <param name="request">
 /// The stream to the SDMX-ML message
 /// </param>
 public static void LogSdmx(WsInfo config, XmlDocument request)
 {
     if (config.LogSDMX)
     {
         Logger.Info(request.InnerXml);
     }
 }
 /// <summary>
 /// Log the SDMX-ML message stored in the stream.
 /// </summary>
 /// <param name="config">
 /// The config
 /// </param>
 /// <param name="request">
 /// The stream to the SDMX-ML message
 /// </param>
 public static void LogSdmx(WsInfo config, string request)
 {
     if (config.LogSDMX)
     {
         Logger.Info(request);
     }
 }
 /// <summary>
 /// Log the SDMX-ML message stored in the stream.
 /// </summary>
 /// <param name="config">
 /// The config
 /// </param>
 /// <param name="tempFileName">
 /// The temporary file name
 /// </param>
 /// <param name="prefix">
 /// A prefix message to log before the SDMX-ML message
 /// </param>
 public static void LogSdmx(WsInfo config, string tempFileName, string prefix)
 {
     if (config.LogSDMX)
     {
         Logger.Info(prefix);
         using (var reader = new StreamReader(tempFileName, Encoding.UTF8))
         {
             Logger.Info(reader.ReadToEnd());
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NsiClientWS"/> class.
        /// </summary>
        /// <param name="config">
        /// The config
        /// </param>
        public NsiClientWSV21(WsInfo config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

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

            //getting nsiClientWs
            WsInfo wsInfo = new WsInfo(config.Config, SdmxSchemaEnumType.VersionTwo);

            _nsiClientWs = new NsiClientWS(wsInfo);

            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);
        }
        /// <summary>
        /// Gets the WSDL.
        /// </summary>
        /// <param name="config">
        /// The config.
        /// </param>
        private void GetWSDL(WsInfo config)
        {
            var resolver = new XmlProxyUrlResolver();

            resolver.SetConfig(config);

            var settings = new XmlReaderSettings
            {
                IgnoreComments = true, IgnoreWhitespace = true, XmlResolver = resolver
            };
            string wsdlUrl = config.Wsdl;

            if (string.IsNullOrEmpty(wsdlUrl))
            {
                wsdlUrl = string.Format(CultureInfo.InvariantCulture, "{0}?wsdl", config.EndPoint);
            }

            using (XmlReader reader = XmlReader.Create(wsdlUrl, settings))
            {
                this._wsdl = ServiceDescription.Read(reader);
            }
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NsiClientWSRest"/> class.
        /// </summary>
        /// <param name="config">
        /// The config
        /// </param>
        public NsiClientWSRest(WsInfo config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

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

            // Getting nsiClientWs
            WsInfo wsInfo = new WsInfo(config.Config, SdmxSchemaEnumType.VersionTwo);

            this._nsiClientWs = new NsiClientWS(wsInfo);

            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="WSDLSettings"/> class.
 /// Initialize a new instance of the WSDLSettings class with NSIClientSettings configuration
 /// </summary>
 /// <param name="config">
 /// The <see cref="NSIClientSettings"/> config used to retrieve the WSDL URL and other information such as proxy
 /// </param>
 public WSDLSettings(WsInfo config)
 {
     this.GetWSDL(config);
     this.BuildOperationParameterName();
     this.ΒuildSoapActionMap();
 }
 /// <summary>
 /// Setter for NSI Client settings
 /// The settings are used for Proxy and HTTP authentication
 /// </summary>
 /// <param name="config">
 /// The NSI Client settings
 /// </param>
 public void SetConfig(WsInfo config)
 {
     this._config = config;
 }