Rahul Jain

Rahul Jain

  • 1.6k
  • 118
  • 6.4k

SAP HANA Service Layer : Cannot establish trust relationship for the SSL / TLS Secure channel

Jul 31 2017 1:24 AM
I am trying to call SAP Hana Service Layer through my code but I am stumbling upon the below error : So can anyone please help me on this. Error 1st : AuthenticationException: The remote certificate is invalid according to the validation procedure. Error 2nd : WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. Error 3rd : HttpRequestException: An error occurred while sending the request. Some more details about the App - I have created the console app in .net & its execute on the server [Hana Server is locally accessed as both the server are in the LAN] Linux & Windows Server. One more thing - My client is not planning to purchase the domain name & SSL certificate for the SAP Hana Service Layer because it will be consumed by my app internally. The thing is, When I tested the login service via Postman its working fine & I am getting the session details as well but the same url is not working through my code so is there anything more I need to do to access the service ? URL - https://172.17.100.35:50000/b1s/v1/Login // Code to connect to the services !!! using (var client = new HttpClient()) { var credentials = new { UserName = "admin", Password = "", "" }; var json = JsonConvert.SerializeObject(credentials); var response = client.PostAsync(url), new StringContent(json, Encoding.UTF8, "application/json")).Result; if (response.IsSuccessStatusCode) { dynamic content = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result); // Access variables from the returned JSON object var appHref = content.links.applications.href; } }