rest - SAP Hana Service Layer : Could not establish trust relationship for the SSL/TLS secure channel -
i trying call sap hana service layer through code stumbling upon below error : can please me on this.
error 1st : authenticationexception: remote certificate invalid according validation procedure.
error 2nd : webexception: underlying connection closed: not establish trust relationship ssl/tls secure channel.
error 3rd : httprequestexception: error occurred while sending request.
some more details app - have created console app in .net & execute on server [hana server locally accessed both server in lan] linux & windows server.
one more thing - client not planning purchase domain name & ssl certificate sap hana service layer because consumed app internally.
the thing is, when tested login service via postman working fine & getting session details same url not working through code there more need access service ?
url - https://172.17.100.35:50000/b1s/v1/login
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 returned json object var apphref = content.links.applications.href; } }
you need put code before postasync
servicepointmanager.servercertificatevalidationcallback = delegate { return true; };
this avoid validation of certificate.
Comments
Post a Comment