55.4k views
5 votes
What is the default timeout period while calling a webservice from Apex?

1 Answer

3 votes

Final answer:

The default timeout period for an Apex web service callout is 10 seconds. Developers can change this up to a maximum of 120 seconds if needed.

Step-by-step explanation:

The default timeout period while calling a web service from Apex is 10 seconds (10,000 milliseconds). When making callouts to external web services, managing timeout settings is important to ensure that your Apex code handles delays or issues in the web service response effectively. If a service takes longer than the default timeout to respond, the callout will fail with a timeout exception.

Developers can adjust this setting if necessary by using the setTimeout method on the HttpRequest object in Apex. The maximum timeout that can be set is 120 seconds (120,000 milliseconds). This allows some flexibility depending on the expected response time from the external service.

The default timeout period while calling a webservice from Apex is 120 seconds.

This means that if a webservice call takes longer than 120 seconds to complete, it will time out and an exception will be thrown.

It's worth noting that you can also specify a custom timeout value when making the webservice call, if needed.

User Richard Lalancette
by
8.4k points