Calls to a remote system can be performed from a batch job. This allows for batch remote process execution and for Suboptimal A batch Apex job that performs an Apex SOAP or HTTP callout in a synchronous manner. processing of the response from the remote system in Salesforce. However, there are limits to the number of calls for a given batch context. For more information, see Governor Limits. A given batch run can execute multiple transaction contexts (usually in intervals of 200 records). The governor limits are reset per transaction context. Sketch The following diagram illustrates a synchronous remote process invocation using Apex calls, where the state needs to be tracked by Salesforce. 10 Remote Process Invocation — Request and Reply
In this scenario: 1. The user initiates an action on the Visualforce page (for example, clicks a button). 2. The browser performs an HTTP POST that in turn performs an action on the corresponding Apex controller. 3. The controller calls a previously-generated Apex Web service proxy class. 4. The proxy class performs the actual call to the remote Web service. 5. The response from the remote system is returned to the Apex controller, which then processes the response, updates any data in Salesforce as required, and re-renders the page. In cases where subsequent state needs to be tracked, the remote system returns a unique identifier that ’ s stored on the Salesforce record. Results The application of the solutions related to this pattern allows for event-initiated remote process invocations, where the result of the transaction needs to be handled by the invoking process in Salesforce. Calling Mechanisms The calling mechanism depends on the solution chosen to implement this pattern. Description Calling mechanism Used when the remote process is to be triggered, as part of an end-to-end process involving the user interface, and the resulting state must be displayed to the end-user and/or updated in a Visualforce and Apex controllers Salesforce record. For example, the submission of a credit card payment to an external payment gateway, where the payment results are immediately returned and displayed to the user. 11 Remote Process Invocation — Request and Reply
Description Calling mechanism Integration that ’ s triggered from user interface events usually requires the creation of custom Visualforce pages. Used primarily for invocation of remote processes using Apex callouts from DML-initiated events. For more information about this calling mechanism, see pattern Remote Process Invocation — Fire and Forget . Apex triggers Used for invocation of remote processes in batch. For more information about this calling mechanism, see pattern Remote Process Invocation — Fire and Forget . Apex batch classes Error Handling and Recovery An error handling and recovery strategy must be considered as part of the overall solution.
You've reached the end of your free preview.
Want to read all 53 pages?
- Winter '14
- Data Management, Enterprise application integration, remote process