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
avtopi786avtopi786 

Web Service Callout (future method)

Hi All,

 

Is Future method recommended on web service call out or always required ?

 

We built a class that calls external web service from SFDC. The method that calls web service is defined as future (asynchronous). Since there is a limit on number of future calls per 24 hours, I am wondering if I can synchronously call external web service. The future method is one of considerations that SFDC has listed on this link: http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts

 

Any suggestions ?

 

Many thanks in advance!

 

bob_buzzardbob_buzzard

You can synchronously call a web service, but you can't have any database changes pending at the point that you call it.

 

E.g. you can synchronously call a web service from a visualforce controller action method if you haven't carried out any DML, but you can't from a trigger, as you would be holding up the transaction for potentially some time.