web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Using NAV CU1290 SOAP Web Service Request Mgt. to connect with a server using a self-signed certificate - HttpWebRequest.GetResponse Error "The remote certificate is invalid according to the validation procedure."

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    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);

  • Verified answer
    keoma Profile Picture
    32,729 on at

    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#.

  • John DeAguiar Profile Picture
    on at

    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.

  • Verified answer
    keoma Profile Picture
    32,729 on at

    correct, DisableHttpsCheck is for using http.

  • Community Member Profile Picture
    on at

    Hi,

    Did you solve your problem?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans