Ejemplo n.º 1
0
        /// <summary>
        /// nacteni dat z instance Jazz
        /// </summary>
        /// <param name="url">URL s XML daty</param>
        /// <param name="username">prihlasovaci jmeno pro HTTP basic auth k Jazz</param>
        /// <param name="password">heslo pro HTTP basic auth k Jazz</param>
        /// <returns></returns>
        private async Task <string> GetDataFromJazzReportingService(string url, string username, string password)
        {
            using (HttpClientHandler handler = new HttpClientHandler())
            {
                handler.ServerCertificateCustomValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; //pro self signed SSL certifikat - upusti od kontroly certifikatu

                using (HttpClient client = new HttpClient(handler))
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", ClientApi.GetHttpBasicHeader(username, password));

                    HttpResponseMessage response = await client.GetAsync(url);

                    return(await response.Content.ReadAsStringAsync());
                }
            }
        }