/// <summary> /// Initializes a new instance of the <see cref="WSClientStream_"/> class. /// Initialize a new instance of the WSClientStream class /// It sets the endpoint, WSDL URL, authentication, proxy and method information /// </summary> /// <param name="settings"> /// The Web Service settings. /// </param> public WebServiceClientStreaming(WsConfigurationSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } this._settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="WebServiceClient"/> class. /// Initialize a new instance of the WebServiceClient class /// It sets the endpoint, WSDL URL, authentication, proxy and method information /// </summary> /// <param name="settings"> /// The Web Service settings. /// </param> public WebServiceClient(WsConfigurationSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } this._settings = settings; this._availableOperations = new List <string>(); this._operationParameterName = new Dictionary <string, string>(); try { this.ParseWSDL(); } catch (WebException ex) { var errorMessage = this.HandleWebException(ex); //throw new WebException(string.Format(enCulture, Resources.ErrorParsingWsdlFormat1, errorMessage), ex, ex.Status, ex.Response); throw new WebException(errorMessage, ex, ex.Status, ex.Response); } catch (InvalidOperationException ex) { //throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Resources.ErrorParsingWsdlFormat1, ex.Message, ex)); throw new InvalidOperationException(ex.Message); } catch (UriFormatException ex) { //throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Resources.ErrorParsingWsdlFormat1, ex.Message, ex)); throw new InvalidOperationException(ex.Message); } try { this._webRequest = this.CreateWebRequest(); } catch (WebException ex) { var errorMessage = this.HandleWebException(ex); throw new WebException("Error accessing Web Service. " + errorMessage, ex); } catch (UriFormatException ex) { throw new InvalidOperationException("Error parsing Endpoint URL." + ex.Message, ex); } }
/// <summary> /// Gets the current applications <WsConfiguration> section. /// </summary> /// <param name="ConfigLevel"> /// The <ConfigurationUserLevel> that the config file /// is retrieved from. /// </param> /// <returns> /// The configuration file's <WsConfiguration> section. /// </returns> public static WsConfigurationSettings GetSection(ConfigurationUserLevel ConfigLevel) { /* * This class is setup using a factory pattern that forces you to * name the section <WsConfiguration> 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. */ System.Configuration.Configuration Config = ConfigurationManager.OpenExeConfiguration (ConfigLevel); WsConfigurationSettings oWsConfigurationSettings; oWsConfigurationSettings = (WsConfigurationSettings)Config.GetSection("WsConfigurationSettings"); if (oWsConfigurationSettings == null) { oWsConfigurationSettings = new WsConfigurationSettings(); Config.Sections.Add("WsConfigurationSettings", oWsConfigurationSettings); } oWsConfigurationSettings._Config = Config; return(oWsConfigurationSettings); }