Hi,
I'm attempting to consume an external rest service , I've setup in the visual designer, but when testing I get a connection error.
Code: Select all
ERROR Error performing request: Connect to beta.check-mot.service.gov.uk:443 [beta.check-mot.service.gov.uk/149.126.74.146] failed: Connection timed out: connect
Code: Select all
var client = new RestClient("https://beta.check-mot.service.gov.uk/trade/vehicles/mot-tests?registration=myreg")
var request = new RestRequest();
request.AddHeader("x-api-key", "mykeygoeshere");
client.Proxy = new WebProxy("http://myproxygoeshere:8080"); <-- assign the proxy
client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
IRestResponse response = client.Execute(request);
var content = response.Content;
I can't see anywhere I'd define that in the service. The proxy server is set in the server admin console as far as I can see?
I also had a stab at doing it within code, bypassing the visual, following the Spotify example you've published - but the x-api-key bit fails
[EDIT] - My bad - altered the object assignment, now get same error as above
Code: Select all
importPackage(com.ebasetech.xi.api);
importPackage(com.ebasetech.xi.services);
var header = {};
var param ={};
param["registration"]="myreggoeshere";
header["x-api-key"]="myapikeygoeshere";
var response= services.rest.get("https://beta.check-mot.service.gov.uk/trade/vehicles/mot-tests", header, param);
log("here");
if(response.isSuccess())
{
if(response.getBody())
{
log(response.getBody());
}
}
Cheers,
Pete