Working in NAV 2017, I'm trying to use CU1290 SOAP Web Service Request Mgt. to send a request and get a response from a server using a self-signed certificate. I've installed the certificate on the server with certlm in Trusted Root Certificate Authorities. I can make the request through my browser (which does still show a certificate error) but calling through the NAV library and eventually DotNet's System.Het.HttpWebRequest.GetResponse, I get the failure message "The remote certificate is invalid according to the validation procedure."
I see from the DotNet forums that you can override the certificate validation logic by installing a callback for ServicePointManager.ServerCertificateValidationCallback (https://stackoverflow.com/questions/1189897/net-programming-what-to-validate-on-an-ssl-self-signed-certificate).
The problem is, I can't figure out how to load a callback from within C/AL. Is this possible? Is there another way to disable the certificate test, ideally on a call-by-call basis? Should I just do all this in DotNet and give up on CU1290?
*This post is locked for comments
Hi,
Did you solve your problem?
correct, DisableHttpsCheck is for using http.
Thanks for your prompt response, Stefano. I did have DisableHttpsCheck, but that didn't help. I believe that DisableHttpsCheck is intended to permit use of http (instead of requiring https.) My problem is that the target services was https using a self-signed certificate.
that won't work using cu 1290 and .net class httpwebrequest.
as you found also out, what you need for certificates like that is following c# code in nav:
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
{
return true;
};
that's not possible in nav.
i had that issue, developed then a .net lib for the complete web service call in c#.
Try DisableHttpsCheck:
WebServReqMgt.SetGlobals(ReqBodyInStream,Url,Username,Password);
WebServReqMgt.DisableHttpsCheck;
WebServReqMgt.RUN;
// get the response
WebServReqMgt.GetResponseContent(RespBodyInStream);
ResponseXmlDoc := ResponseXmlDoc.XmlDocument;
ResponseXmlDoc.Load(RespBodyInStream);
MESSAGE(ResponseXmlDoc.InnerXml);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156