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
Pierre CastoriPierre Castori 

Increase callout timeout

Hi,

I have a problem with a web service callout that continuously gets a timeout. The web service is called through a WSDL generated class. I read in the forums about the timeout_x variable and that we could assign up to 60 sec to this variable. The problem is the behaviour is the same whatever value I assign this variable to (from 1 ms to the max 60000 ms). The timeout still occurs after about 10 seconds.

Did you already experience that?  And how can I change the value of this variable? Thanks.
Sri549Sri549
Hello Pierre,

As per your requirment TIme out for Webservice callout will be 1,20,000 MS ,i.e.like 2Sec.For Clearance You can refer Governer Limits
provided link,http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm


If your clear with your requirment,Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Srinivas
SFDC Certified Developer


Elie.RodrigueElie.Rodrigue
Timeout_x is the variable you are looking for in the wsdl2apex generated code. However as you figured out. You should be able to increase it up to 120 seconds.

SampleClass.BasicHttpBinding_IService1 s = new SampleClass.BasicHttpBinding_IService1();
                s.timeout_x = 120000;

Is the way we usually do it. you can also harcode the value in the generated apex class.


pitoubec74pitoubec74
I think I wasn't clear enough maybe. I know about timeout_x already and the related governor limits. I used timeout_x the way you suggest and tried several values (40000, 60000, 120000 and even just 1). No matter what value I assign to timeout_x I always get the same result: System.CalloutException IO Exception: Read timed out after about 10 sec. It seems that the value given to this variable is not taken into account at all by the WebServiceCallout.invoke function.