Making HTTPS connections through proxy with authentication from MID Server Script Include

Marek Meres
Tera Expert

Hello Guys,

 

I need to transfer big files (100MB) from the MID server to the instance for loading and I am trying to find a solution. The preferred one would be using attachment API I guess. In my case the MID server is behind a proxy which requires authentication.

 

I investigated Remote File Importer (Import Files from a MID Server) - Share | ServiceNow Developers and found out it uses MID server's own connection parameters including proxy settings but does not use proxy authentication hence I am getting errors from proxy. Do you know how to add proxy username and password to the MID server script include?

 

I tried simply adding:

Packages.java.lang.System.setProperty("http.proxyUser", ms.getConfigParameter("mid.proxy.username"));
Packages.java.lang.System.setProperty("http.proxyPassword", ms.getConfigParameter("mid.proxy.password"));
Packages.java.lang.System.setProperty("https.proxyUser", ms.getConfigParameter("mid.proxy.username"));
Packages.java.lang.System.setProperty("https.proxyPassword", ms.getConfigParameter("mid.proxy.password"));

but it did not work.

 

Then I tried:

var proxyuserpass = new Packages.java.lang.String(ms.getConfigParameter("mid.proxy.username") + ":" + ms.getConfigParameter("mid.proxy.password"));
 var proxyAuth = "Basic " + (new Packages.javax.xml.bind.DatatypeConverter.printBase64Binary(proxyuserpass.getBytes()) + '');
conn.setRequestProperty("Proxy-Authorization", proxyAuth);   

 but again - no luck...

 

Thanks in advance!

1 ACCEPTED SOLUTION

Hi, This remote file importer may not be up to date, probably deploying it to the instance of latest releases is too risky

Appli_0-1709564383900.png

Downloading from MID server - consider another method - set up SFTP server on MID server' host and retrieve the file over data source of SFTP type.  Integration Hub (Pro or Ent) supports SFTP steps making it possible to use Flow Designer for SFTP operations.

 

Hope it helps

View solution in original post

9 REPLIES 9

Appli
Mega Sage
Mega Sage

Hi, please check if these MID server properties are set; as per DOC pagemid.proxy.username and mid.proxy.password

Hope it helps

Hi Appli, yes, these are set and the MID server itself connects successfully. Here I wanted to make a connection from MID Server Script Include using those parameters (so the proxy username and password does not need to be hardcoded or stored separately somewhere) but it seems the proxy parameters set as in my original post does not work.

Hi, thank you for replying. May you please check if solution provided in this thread addresses your query.

 

Hope it helps

Thanks for that! Although it does not fit directly into the approach I took based on Remote Importer (it uses Packages.java.net.URL(<url>).openConnection() instead of Packages.com.glide.communications.HTTPRequest(<url>)) I will explore the provided solution when I have some time (there was a change in the approach now).