After some playing around I was able to setup a basic HTTP GET using Java and supplying NTLM auth.
However, I am finding that I am getting import errors in the Gateway Scope, but not in the Designer scope. I am running the same Java (8.231) on both designer and gateway, is there some odd difference in context of why the below might fail?
# Perform a basic HTTP Get to the provided URL using the NTLM auth in the function
def _httpGetNTLM(url):
from org.apache.http.auth import AuthScope
from org.apache.http.auth import NTCredentials
from org.apache.http.client.methods import HttpGet
from org.apache.http.impl.client import DefaultHttpClient
from org.apache.http.impl.client import BasicResponseHandler
from org.apache.http.entity import ContentType
# Setup the client with NTLM Auth
httpclient = DefaultHttpClient()
# Define the credentials to use
creds = NTCredentials("USERNAME", "PASSWORD", system.net.getHostName(), "DOMAINHERE")
httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds)
# Define the host and URL to call
httpget = HttpGet(url)
# Execute the request
response = httpclient.execute(httpget)
# Handle the response
content = BasicResponseHandler().handleResponse(response)
contentType = ContentType.getOrDefault(response.getEntity()).getMimeType()
# Return the result
if 'json' in contentType.lower():
return system.util.jsonDecode(content)
else:
return content
Results return fine in the Designer (script console). On the gateway, I get the following:
Traceback (most recent call last):
...
...
File "", line 33, in _httpGetNTLM
ImportError: No module named http