Synchronous Outbound Web Service Calls Timing Out After 2 min

srivatsa_tatti
Mega Sage

Hi

I have a REST message using an HTTP POST request. It's an application used to retrieve data, and sometimes it takes more than 2 minutes to respond with the data. Even though the target instance has not responded, we receive either blank responses or socket errors in such cases. I've attempted to set the setHttpTimeout()  both 3 minutes and 5 minutes, but it still fails. It appears that the API is only waiting for a response for 2 minutes.

 

 

 

 

 

 

var body = '{"product_num":"PROD20106","source": "PROD"}';
var r = new sn_ws.RESTMessageV2();
r.setEndpoint('endpoint');
r.setHttpMethod('POST');
r.setHttpTimeout('180000');
r.setRequestHeader("Authorization", 'Basic authentication');
r.setRequestHeader("x-api-key", "key here");
r.setRequestHeader("Content-Type", "application/json");
r.setRequestBody(body);
r.setHttpTimeout(180000);
var response = r.execute();
//response.waitForResponse(90);
var statusCode = response.getStatusCode();
if (statusCode === 200) {
var responseBody = JSON.parse(response.getBody());
gs.info("SRI Response statusCode: " + statusCode);
} else {
var err = 'Could not retrieve data - Request failed with code ' + statusCode;
gs.info("SRI Error: " + err);
}

 

 

 

 

I get outputs as

 

 

 

 

x_snc_price_master: START execution: 2023-09-28 01:59:33 {"product_num":"PROD20106","source": "PROD"} x_snc_price_master: Before REST request execution: 2023-09-28 01:59:33 {"product_num":"PROD20106","source": "PROD"} Socket error: Connection reset x_snc_price_master: Error: Could not retrieve data - Request failed with code 0 x_snc_price_master: After REST request execution: 2023-09-28 02:01:33 {"product_num":"PROD20106","source": "PROD"}

 

 

 

 

Tried with executeAsync() as well. Tried to modify the below properties as well.

'glide.http.outbound.max_timeout.enabled' to True
glide.http.outbound.max_timeout = 600000
glide.http.timeout' to '1750000'
'glide.http.connection_timeout' to '1000000'.

 

 

Also, I tried to configure the REST message and tested by hitting  "TEST" which is OUT OF THE BOX rest message test feature. It is still failing at 2 mins. The API flaps exactly at 2 mins, and tried running the code in BS, in scoped/global its the same issue.

 

 Any help on this in much appreciated.

 

Thanks

Sri

0 REPLIES 0