go to post Leon Stokes · Jan 9, 2020 Thanks for the recommendation Raj - in the short term we have customers with both Cache and IRIS and prefer not to have logic to determine which dlls to use.
go to post Leon Stokes · May 15, 2019 I have Cache 2016.1 (not Ensemble or IRIS) and need to duplicate the functionality of this C# .net code. The target REST web service is a 3rd party not using Intersystems products.public static TokenResponseModel getBearerToken(string siteUrl, string Username, string Password) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri(siteUrl); client.DefaultRequestHeaders.Accept.Clear(); // uncomment to allow self signed certificates for https requests System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; HttpContent requestContent = new StringContent("grant_type=password&username=" + Username + "&password=" + Password, Encoding.UTF8, "application/x-www-form-urlencoded"); HttpResponseMessage responseMessage = client.PostAsync("Token", requestContent).Result; if (responseMessage.IsSuccessStatusCode) { string jsonMessage; using (Stream responseStream = responseMessage.Content.ReadAsStreamAsync().Result) { jsonMessage = new StreamReader(responseStream).ReadToEnd(); } TokenResponseModel tokenResponse = (TokenResponseModel)JsonConvert.DeserializeObject(jsonMessage, typeof(TokenResponseModel)); return tokenResponse; } else { return null; } }
go to post Leon Stokes · May 13, 2019 Thanks for your response. Will this work if the REST web service I am targeting is a 3rd party not running Cache or using CSP?