on 10-26-2015 11:27 AM
I am trying to connect to outbound service and I get this error:
{"ERROR":"HttpClient.request: request failed. The following error occured: unable to establish connection to http://api.openweathermap.org:80 - internal error code: connection failed"}
I tried several variants but it does not work.
Service url:
http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f
.xshttpdest file:
host = "http://api.openweathermap.org";
port = 80;
description = "Weather";
useSSL = false;
pathPrefix = "data/2.5";
authType = none;
useProxy = false;
proxyHost = "";
proxyPort = 0;
timeout = 0;
.xsjs file:
var destination;
var client;
var request;
//Read the input employee number which is to be read
try{
//Reading the destination properties
destination = $.net.http.readDestination("s0015145715trial.development.machines.services","gate");
//Creating HTTP Client
client = new $.net.http.Client();
//Creating Request
request = new $.web.WebRequest($.net.http.GET,"weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f");
client.request(request,destination);
//Getting the response body and setting as output data
$.response.setBody(client.getResponse().body.asString());
}
catch(errorObj){
$.response.setBody(JSON.stringify({
ERROR : errorObj.message
}));
}
Hello Matej,
you have to adjust following points in your files.
.xshttpdest:
.xsjs:
Best Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.