/// <summary> /// Initializes a new instance of the <see cref="WSDLSettings"/> class. /// Initialize a new instance of the WSDLSettings class with EndpointSettings configuration /// </summary> /// <param name="config"> /// The <see cref="EndpointSettings"/> config used to retrieve the WSDL URL and other information such as proxy /// </param> public WSDLSettings(EndpointSettings config) { this.GetWSDL(config); this.BuildOperationParameterName(); this.ΒuildSoapActionMap(); }
/// <summary> /// Initializes a new instance of the <see cref="GetSDMX_WSV20"/> class. /// </summary> /// <param name="config"> /// NSIClient settings /// </param> public GetSDMX_WSV20(EndpointSettings config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(config.EndPoint)) { //throw new ArgumentException(Resources.ExceptionEndpointNotSet, "config"); } this._config = config; try { this._wsdlConfig = new WSDLSettings(config); } 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(EndpointSettings config) { try { 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); } //System.Net.WebProxy myProxy = new System.Net.WebProxy(); //myProxy.UseDefaultCredentials = true; //System.Uri newUri = new System.Uri("http://proxy.istat.it:3128"); //myProxy.Address = newUri; System.Net.WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; System.Net.WebRequest request = System.Net.WebRequest.Create(wsdlUrl); request.UseDefaultCredentials = true; var webProxy = System.Net.WebProxy.GetDefaultProxy(); webProxy.UseDefaultCredentials = true; request.Proxy = webProxy; using (System.Net.WebResponse response = request.GetResponse()) using (XmlReader reader = XmlReader.Create(response.GetResponseStream())) { this._wsdl = ServiceDescription.Read(reader); } //using (XmlReader reader = XmlReader.Create(wsdlUrl, settings)) //{ // this._wsdl = ServiceDescription.Read(reader); //} } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); } }
/// <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(EndpointSettings config) { this._config = config; }