/// <summary> /// Makes service url using <see cref="IRoutingServiceUrlProvider"/> /// instance to obtain a server url and path and query components from /// <paramref name="baseUrl"/>. /// </summary> /// <param name="self">An <see cref="IRoutingServiceUrlProvider"/> to /// obtain server url from.</param> /// <param name="baseUrl">A url whose path and query components /// will be used for making service url.</param> /// <returns>A new routing service url.</returns> public static string MakeServiceUrl( this IRoutingServiceUrlProvider self, string baseUrl) { Debug.Assert(self != null, "Expects a non-null service url provider."); return(UriHelper.Concat(self.QueryServiceUrl(), baseUrl)); }
/// <summary> /// Creates authenticator instance. /// </summary> /// <param name="parameters">Connection parameters to be used.</param> /// <param name="serviceUrlProvider">Url provider instance to /// retrieve server url from.</param> /// <returns>new authenticator instance.</returns> private Authenticator _CreateAuthenticator( AgsServerConnectionParameters parameters, IRoutingServiceUrlProvider serviceUrlProvider) { var soapUrl = parameters.SoapUrl; if (serviceUrlProvider != null) { soapUrl = _serviceUrlProvider.QueryServiceUrl(); } var authenticator = new Authenticator(soapUrl, _config.TokenType); return(authenticator); }
internal AgsServer(ServerInfoWrap config, NetworkCredential licenseAccount, IRoutingServiceUrlProvider serviceUrlProvider) { Debug.Assert(config != null); // set server parameters _name = config.Name; _title = config.Title; _description = config.Description; _helpPrompt = config.HelpPrompt; _config = config; // init connection _InitParameters(config, licenseAccount); _serviceUrlProvider = serviceUrlProvider; // create authenticator _authenticator = _CreateAuthenticator(_parameters, _serviceUrlProvider); try { // connect/authenticate _Connect(); _state = AgsServerState.Authorized; } catch (AuthenticationException) { _state = AgsServerState.Unauthorized; _initError = _CreateAuthException(); } catch (Exception e) { _state = AgsServerState.Unavailable; _initError = _ConvertException(e); Logger.Error(e); } }
internal AgsServer(ServerInfoWrap config, NetworkCredential licenseAccount, IRoutingServiceUrlProvider serviceUrlProvider) { Debug.Assert(config != null); // set server parameters _name = config.Name; _title = config.Title; _description = config.Description; _helpPrompt = config.HelpPrompt; _config = config; // init connection _InitParameters(config, licenseAccount); _serviceUrlProvider = serviceUrlProvider; // create authenticator _authenticator = _CreateAuthenticator(_parameters, _serviceUrlProvider); try { // connect/authenticate _Connect(); _state = AgsServerState.Authorized; } catch (AuthenticationException) { _state = AgsServerState.Unauthorized; _initError = _CreateAuthException(); } catch (Exception e) { _state = AgsServerState.Unavailable; _initError = _ConvertException(e); Logger.Error(e); } }
/// <summary> /// Creates authenticator instance. /// </summary> /// <param name="parameters">Connection parameters to be used.</param> /// <param name="serviceUrlProvider">Url provider instance to /// retrieve server url from.</param> /// <returns>new authenticator instance.</returns> private Authenticator _CreateAuthenticator( AgsServerConnectionParameters parameters, IRoutingServiceUrlProvider serviceUrlProvider) { var soapUrl = parameters.SoapUrl; if (serviceUrlProvider != null) { soapUrl = _serviceUrlProvider.QueryServiceUrl(); } var authenticator = new Authenticator(soapUrl, _config.TokenType); return authenticator; }