/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="NsiClientWS"/> class. /// </summary> /// <param name="config"> /// NSIClient settings /// </param> public NsiClientWS(WsInfo config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(config.EndPoint)) { throw new ArgumentException(Resources.ExceptionEndpointNotSet, "config"); } Logger.Info(Resources.InfoCreatingNsiClient); this._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> /// 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> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> public static void Main(string[] args) { var info = new RequestInfo { Endpoint = "http://localhost/nsiws/NSIStdV20Service.asmx", Request = new FileInfo(@"query.xml"), Response = new FileInfo(@"response.xml"), Operation = "GetCompactData" }; WSDLSettings wsdlSettings; try { wsdlSettings = new WSDLSettings(info.Endpoint + "?wsdl"); } catch (Exception ex) { Console.Error.WriteLine("Error while retrieving WSDL"); Console.Error.WriteLine(ex.ToString()); Console.ReadLine(); return; } info.Parameter = wsdlSettings.GetParameterName(info.Operation); info.SoapAction = wsdlSettings.GetSoapAction(info.Operation); info.TargetNamespace = wsdlSettings.TargetNamespace; try { SendRequest(info); } catch (Exception ex) { Console.Error.WriteLine("Error while sending request"); Console.Error.WriteLine(ex.ToString()); Console.ReadLine(); throw; } Console.WriteLine("Success"); }