OL Learn

HTTP Client input - GET pdf from HTTPS server

I’m on Connect 2019.2 and am attempting to use the HTTP Client input task to retrieve PDF files from a remote HTTPS server.

When attempting this I receive the following error:
[0003] W3730 : Error resolving the URL : Error connecting with SSL.

Is the HTTP Client capable of retrieving files via HTTPS?

I tried using it against a couple of the PDF files on the OL Connect help site and got the same error.

For example, if I try to download this PDF file via the HTTP Client I get the error:

The help file for the HTTP Client mentions HTTPS is supported.

Is there a way to do this with the HTTP Client task? Or do I need to shift to scripting cURL or similar utility?

Thanks!

I confirm this issue.

Probably because the remove site doesn’t support SSL (it’s been deprecated for a while, but that plugin still uses it).

The following script will achieve what you want:

var xhr = new ActiveXObject("Microsoft.XMLHTTP");
xhr.open("GET","https://help.objectiflune.com/en/planetpress-workflow-user-guide/2019.2/planetpress-workflow-user-guide.pdf",false);
xhr.send();

var binaryStream = new ActiveXObject("ADODB.Stream")
binaryStream.Type = 1;
binaryStream.Mode = 3;
binaryStream.Open();
binaryStream.Write(xhr.responseBody);
binaryStream.SaveToFile(Watch.GetJobFileName(),2);
binaryStream.Close();

Hi Phil,

I am getting the same Error as above when using the HTTP Input Client to try to download a PDF from a URL that requires Authentication.

Could your script above be modified to pass credentials to the download site?

Thanks!

If the server accepts Basic Authentication, then all you have to do is add the following line immediately before the xhr.send(); line:

xhr.setRequestHeader("Authorization", "Basic " + btoa(USER_NAME+":"+USER_PASSWORD));

Make sure your script language is set to Enhanced JScript (i.e. not the standard JScript, which does not implement the btoa() method).

And, obviously, set the USER_NAME and USER_PASSWORD values to match your credentials.