How to make long-running RESTMessageV2 call using MID?

davidnia
Giga Contributor

Hi All,

I am on Fuji Patch 8.

The endpoint is expected to take 11 minutes to respond, but the call from REST message times out.

Here is the ECC response:

<results error="The request failed: Socket timeout" probe_time="185236">

I have also set the property:

glide.rest.outbound.ecc_response.timeout to 1500000

glide.http.timeout to 1500000

glide.http.connection_timeout to 1500000

Here is the code I run:

              var restMessage   = new sn_ws.RESTMessageV2( 'ABC', 'get' );

              restMessage.setEccParameter( 'skip_sensor', 'true' );

              restMessage.setStringParameter( 'url', 'https://abc.blah.com' );

              restMessage.setStringParameter( 'resource_name', 'books' );

              restMessage.setStringParameter( 'query', 'active=TRUE' );

              restMessage.setHttpTimeout(150000);

              restMessage.execute();

Why is this timing out at roughly 3 minutes?

Are the parameters having no effect?

Thank you!

5 REPLIES 5

Matt Saxton - G
Kilo Guru

Hi David,



Try this



var restMessage   = new sn_ws.RESTMessageV2( 'ABC', 'get' );



              restMessage.setEccParameter( 'skip_sensor', 'true' );



              restMessage.setStringParameter( 'url', 'https://abc.blah.com' );


              restMessage.setStringParameter( 'resource_name', 'books' );


              restMessage.setStringParameter( 'query', 'active=TRUE' );



              restMessage.setHttpTimeout(150000);



var response = restMessage.execute();


response.waitForResponse(150000);





http://wiki.servicenow.com/index.php?title=RESTResponseV2_API#waitForResponse.28Number_timeoutSecs.2...


Thank you Matt.



Unfortunately this didn't work.   I did a waitForResponse( 15*60) to wait 15 minutes...and the timeout still says 3 minutes.


The call in the background script DID take 15 minutes to complete, but I was watching the ECC queue and see that it times out at 3 minutes.



What is needed I believe is for the MID server to adjust it's HTTP timeout.



David


Hey David,



Did you ever figure out a way to manage this?   I think I might have a similar problem.



Thanks!


Dan


Matt,



I am afraid the solution you provided is not working.



We are having the same issue with long response times. We have tried overriding the default glide.rest.outbound.ecc_response.timeout property using the REST API response.waitForResponse() method but did not work



Any Ideas?



Thanks


Miguel