Facility Control

 View Only
  • 1.  Accessing a file using HTTPS

    Posted 09-13-2017 15:32
    Hi
    Is it possible to access URLs in Dashboard that start with https? I had tried to download a Google doc and couldn't get it to work. Also, what is the function header to use as a callback for the asyncPost?

    Thanks
    Simon


  • 2.  RE: Accessing a file using HTTPS

    Posted 09-13-2017 20:36

    DashBoard does support HTTPS. It is quite likely that the Google Doc URL is providing something other than a simple web page or data stream to download.

    Here is an example:

    function cb(results)
    {
       ogscript.debug(results);
    }
    ogscript.asyncPost('https://httpbin.org/', null, cb);

    The variable "results" will be null if the post was not successful.

    There is also a version that can return more detailed information in a JSON object.

    function cb(results)
    {
       if (results != null)
       {
         ogscript.debug(results.responseCode);
         ogscript.debug(results.contentType);
         ogscript.debug(results.url);
         ogscript.debug(results.value);
         ogscript.debug(results.bytes);
      }
    }
    ogscript.asyncPost('https://httpbin.org/', null, cb, true);

    #DashBoard


  • 3.  RE: Accessing a file using HTTPS

    Posted 09-14-2017 09:13
    Brilliant! Thanks James for the code and also introducing me to the HTTP test site

    Simon
    #DashBoard


  • 4.  RE: Accessing a file using HTTPS

    Posted 09-14-2017 14:32
    Hi James
    This has worked for one project, my other project where I need to download a Google sheet directly has this error:
    sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    I have tried running the javacpl.exe under c:\dashboard\jre\bin and add in what I think are the correct Google certificates, but it doesn't look like it is modifying the cacerts file.

    Is this possible, amd if so, how do I do it please?

    Thanks
    Simon

    #DashBoard


  • 5.  RE: Accessing a file using HTTPS

    Posted 09-14-2017 15:19
    Glad everything is up and running!
    #DashBoard