/// <summary> /// Constructs a <see cref="HealthServiceShellInfo"/> object from the /// supplied XML. /// </summary> /// /// <param name="nav"> /// An XPathNavigator to access the XML from which the /// <see cref="HealthServiceShellInfo"/> object will be constructed. /// </param> /// /// <returns> /// A <see cref="HealthServiceShellInfo"/> object. /// </returns> /// /// <exception cref="UriFormatException"> /// A URL string returned by HealthVault is /// invalid. /// </exception> /// internal static HealthServiceShellInfo CreateShellInfo( XPathNavigator nav) { Uri baseUrl = new Uri(nav.SelectSingleNode("url").Value); Uri redirectUrl = new Uri(nav.SelectSingleNode("redirect-url").Value); XPathNodeIterator tokenNavs = nav.Select("redirect-token"); List <HealthServiceShellRedirectToken> redirectTokens = new List <HealthServiceShellRedirectToken>(); foreach (XPathNavigator tokenNav in tokenNavs) { string token = tokenNav.SelectSingleNode("token").Value; string description = tokenNav.SelectSingleNode("description").Value; string queryParams = tokenNav.SelectSingleNode( "querystring-parameters").Value; string[] queryStringParameters = queryParams.Split(','); HealthServiceShellRedirectToken redirectToken = new HealthServiceShellRedirectToken(token, description, queryStringParameters); redirectTokens.Add(redirectToken); } HealthServiceShellInfo shellInfo = new HealthServiceShellInfo(baseUrl, redirectUrl, redirectTokens); return(shellInfo); }
private ServiceInfo( Uri healthServiceUrl, string healthVaultVersion, HealthServiceShellInfo shellInfo, IList <HealthServiceMethodInfo> methods, IList <Uri> includes, Dictionary <string, string> configurationValues, Dictionary <string, HealthServiceInstance> instances, string currentInstanceId, Instant lastUpdated) { HealthServiceUrl = healthServiceUrl; Version = healthVaultVersion; HealthServiceShellInfo = shellInfo; Methods = new ReadOnlyCollection <HealthServiceMethodInfo>(methods); IncludedSchemaUrls = new ReadOnlyCollection <Uri>(includes); if (configurationValues != null) { ConfigurationValues = configurationValues; } if (instances != null) { ServiceInstances = instances; CurrentInstance = ServiceInstances[currentInstanceId]; } LastUpdated = lastUpdated; }
internal static ServiceInfo CreateServiceInfo(XPathNavigator nav) { Uri platformUrl = null; string platformVersion = null; Dictionary <string, string> configValues; XPathNavigator platformNav = nav.SelectSingleNode("platform"); if (platformNav != null) { platformUrl = new Uri(platformNav.SelectSingleNode("url").Value); platformVersion = platformNav.SelectSingleNode("version").Value; configValues = GetConfigurationValues(platformNav.Select("configuration")); } else { configValues = new Dictionary <string, string>(); } HealthServiceShellInfo shellInfo = null; XPathNavigator shellNav = nav.SelectSingleNode("shell"); if (shellNav != null) { shellInfo = HealthServiceShellInfo.CreateShellInfo( nav.SelectSingleNode("shell")); } Collection <HealthServiceMethodInfo> methods = GetMethods(nav); Collection <Uri> includes = GetIncludes(nav); string currentInstanceId; Dictionary <string, HealthServiceInstance> instances = GetServiceInstances(nav, out currentInstanceId); Instant lastUpdated = SDKHelper.InstantFromUnmarkedXml(nav.SelectSingleNode("updated-date").Value); ServiceInfo serviceInfo = new ServiceInfo( platformUrl, platformVersion, shellInfo, methods, includes, configValues, instances, currentInstanceId, lastUpdated); return(serviceInfo); }