Hi Team,
We are calling an API endpoint from Adobe Campaign Java script activity by using :
var http = new HttpClientRequest(<Our API URL>) and the request is timing out before it could get a response from the End point/API (timing out at approximately 5 mins),
Is there any attribute in server config file which would set the timeout value to a higher number > 5 mins? OR
Do we have to add timeout attribute in the code itself. Do you have a sample code to share?
Thanks,
Ishani
Hello Ishani,
Try the following
Should give you something like
js3 header[Date] => Wed, 05 Jul 2017 10:10:13 GMT
js3 header[Server] => Apache/2.2.22 (Debian)
js3 header[Vary] => Accept-Encoding
js3 header[Content-Length] => 291
js3 header[Keep-Alive] => timeout=5, max=100
js3 header[Connection] => Keep-Alive
js3 header[Content-Type] => text/html; charset=iso-8859-1
You can use the following code as well
var API = 'http://yourwebserviceendpoint.com'
var http = new HttpClientRequest(API);
http.method = "GET";
http.header["Content-Type"] = "application/json";
http.header["Accept"] = "application/json";
http.header["Authorization"] = "Basic Z3XNlbmRleHRlc3QxQGdtYWlsLmNvbTpsb2dpbjEyMzQ="; // replace with your authorization code
http.execute();
var response = http.response;
Regards,
Venu
Thanks Venu.
We are able to send the request but it seems to time out after 5 minutes. My questions is - How do we increase the time out to 10 mins instead?
Views
Replies
Total Likes
Hello Ishani,
The default connect timeout for outgoing http connection is 5sec.
You can change the connection timeout in server.conf file using the attribute value http_connect_timeout.
Click here for more details http://docs.graylog.org/en/3.0/pages/configuration/server.conf.html#web-rest-api
Regards,
Venu
Hi Isha,
Please change your serverConf.xml file, the section with urlPermission to allow outgoing connection.
This is documented in section "Outgoing connection protection" in this documentation:
It was added about 2 years ago in a build for security reasons.
Regards
J-Serge
Hi Isha,
Moreover, you should always use:
try{
<your code>
}
catch(e){
logWarning("Error number: " + e );
}
so the timeout message would have been much more clearer.
Same for other kind of errors.
Then you have a look in the web.log file (on mta server or on applicative server depending on the pbject type) to read the error details.
Regards
J-Serge
Views
Like
Replies