function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
qvisionqvision 

WebService External Callouts - Change Read Timeout

For external webservice callouts there is a read timeout of 10 seconds. Is there a way to change this timeout?
Best Answer chosen by Admin (Salesforce Developers) 
SatgurSatgur

Hi,

 

Apex platform does provide a way to change the default Call time out setting. 

 

Below is the sample code for same -  

 

 

//Web Service Call out Example WSTest.WSMethod1 stub = new WSTest.WSMethod1() ; stub.timeout_x = 20000 ; // timeout in milliseconds //Http call out example HttpRequest req = new HttpRequest() ; req.setTimeOut(20000) ; // timeout in milliseconds

 

 Latest Apex language reference guide also mentions the same.

 

 

 - Satgur

 

All Answers

aalbertaalbert
Currently you can not modify the 10 second timeout on external web service calls from within Apex or SControls.

Steve MaxSteve Max

I thought I read late last year that it was possible to change the 10 second time-out.  I'm currently trying to find where I found that reference as I need to extend my system to about 15 seconds.

 

Steve Max.

rawiswarrawiswar
Steve,
I have a related question in addition to what you are tryign to find out.
suppose i use a variable i retrieve using a web service in another visual force page's url (i need to load an iframe whose url is appended with session id i am retrieving with this web service); would the page load wait until i get the session id from the call?
if not how do i do this?
Thanks
rawiswarrawiswar
found out the variable is not populated to NULL (the page does wait for the associated controller variable to be loaded).
Just curious--> would it wait if the variable is part of another class (not the controller OR does VF wait for all referred variables?)
Steve MaxSteve Max

From a controller class, I call another class which calls the Web Service using a class generated from WSDL.

 I haven't had any problems with VisualForce waiting up to 10 seconds for a response.

rawiswarrawiswar

BTW, Spring '09 has it up at its MAX (60 sec) by default.

 

UPDATE/ CORRECTION: As Manoj points out below, default is 10s, MAX configurable is 60s.

Message Edited by rawiswar on 02-03-2009 01:35 PM
cheenathcheenath

Default callout timeout in Spring '09 is still 10 sec. But you can set a longer timeout for web services and http callout.

 

 

rawiswarrawiswar

Manoj,

From my experience with getting help from you, I guess you know the internals better. So, please let me know if the page below is listing wrong information. please watch the video on this page ----

http://www.salesforce.com/community/spring09/it/force-integration/compatible-web-services.jsp#

 

Quoted below is the test from the same page

"Apex callout time limits have been relaxed to allow calls lasting up to 1 minute. Developers who want calls to time out sooner can set a custom timeout value. "

 

Either way, I guess I will find out when I look at the new API docs.

 

BTW, where do I look at on the PDFs we download (Force.com library), to know the API vesion number ???

cheenathcheenath

Ya, it is an error in the doc. Default is still 10 sec.

 

SatgurSatgur

Hi,

 

Apex platform does provide a way to change the default Call time out setting. 

 

Below is the sample code for same -  

 

 

//Web Service Call out Example WSTest.WSMethod1 stub = new WSTest.WSMethod1() ; stub.timeout_x = 20000 ; // timeout in milliseconds //Http call out example HttpRequest req = new HttpRequest() ; req.setTimeOut(20000) ; // timeout in milliseconds

 

 Latest Apex language reference guide also mentions the same.

 

 

 - Satgur

 

This was selected as the best answer