You need to sign in to do that
Don't have an account?
eswarsf
Why visualforce controllers will allow webservice callout?
Hi,
I would like to know "Why visualforce controllers will allow webservice callouts?".
I know Triggers will not allow because of Synchronous responses,but VisualForce page also will have to wait till webservice callout is successfull.
Thanks.
Once a DML operation has started, the records involved are locked from any other process (a row-level lock is applied to those records). Those records can't be edited until the transaction completes. The governor limits allow 120 seconds of total call out time, which means that a trigger that calls an external service could lock up to 50,000 rows for up to two minutes. According to salesforce, this is a major DOS (denial of service) for other users on the platform. This is why triggers cannot produce callouts. Conversely, Visualforce pages do not lock any rows until they start a DML operation. This means that you can callout for up to 120 seconds, and the related records will only be locked for a few seconds instead of potenially several minutes. There is a rule that you cannot callout in Visualforce once you have performed any DML operation, so this prevents long-running row-locks.
All Answers
Once a DML operation has started, the records involved are locked from any other process (a row-level lock is applied to those records). Those records can't be edited until the transaction completes. The governor limits allow 120 seconds of total call out time, which means that a trigger that calls an external service could lock up to 50,000 rows for up to two minutes. According to salesforce, this is a major DOS (denial of service) for other users on the platform. This is why triggers cannot produce callouts. Conversely, Visualforce pages do not lock any rows until they start a DML operation. This means that you can callout for up to 120 seconds, and the related records will only be locked for a few seconds instead of potenially several minutes. There is a rule that you cannot callout in Visualforce once you have performed any DML operation, so this prevents long-running row-locks.