With Outbound Message, we do not need to write any code in Salesforce to make this integration happen. But, the other party need to consume message in SOAP web service sent by Salesforce, whether by writing code to consume Endpoint WSDL generated in Salesforce, or using kinds of middleware that able to parse and consume web service sent.
We can include Session Id for the other system to access Salesforce, example: when an Account flip from Prospect to Customer, we send Account information to external system, the external system receive the message and send ack response. After that, the external system create the same Account in their system and send back to the ID created to Salesforce as External ID by update Salesforce Account.
Integration is never be simple, but to test and make sure that Salesforce is sending the right fields, sessionId, etc. We can use API traffic monitoring tool such as Runscope to collect requests made and let you inspect them in a human-friendly way. Runscope is not free, but a scale down version RequestBin available for free, although it will store the incoming message in short period only.
1. Create bucket in Runscope
It will create a key for bucket created, such as: qzmf6xszmqqb
Click Captured menu and you should see the URL, example: https://qzmf6xszmqqb.runscope.net
2. Setup Outbound Message
Navigate to Setup | Create | Workflow & Approvals | Outbound Messages
Create New Outbound Message
Enter the Outbound Message Name, Object, Endpoint URL would be above URL, Send Session Id (if needed), and Fields to Send.
3. Setup Workflow or Approval Process
This is standard Salesforce Workflow or Approval Process, just add Outbound Message created as the action.
4. Test
When the record triggered by Workflow or Approval Process, Outbound Message will send SOAP web service to defined URL.
Open Runscope and click Captured menu, you should see captured POST request in SOAP message format. You can compare the messages here, with the configuration in Salesforce Outbound Message.
As you see the message will include:
- OrganizationId
- ActionId - 04k
- SessionId (we enable this in the configuration)
- EnterpriseUrl
- PartnerUrl
- OutboundMessageId - 04l
- ObjectName
- ObjectId
But, because Runscope or RequestBin cannot reply ack notification, Salesforce will keep send the message until expired, you can monitor and delete them manually from Setup | Monitor | Outbound Messages.
The outbound messaging service also features a retry mechanism on failed outbound messages, Salesforce waits for an acknowledgment from the remote system for up to 10 seconds. The retry interval increases exponentially over time, starting with 15-second intervals and ending with 60-minute intervals. Administrators must monitor this queue for any messages exceeding the 24 hour delivery period and retry manually, if required. Salesforce retries sending the outbound message request for up to 24 hours.
Option
Instead of Runscope or RequestBin, use Integration Playground provided by Salesforce for testing. With this tool, you can play monitor incoming message, and to toggle on and off for the "ack" notification.
Reference:
- Understanding the Outbound Messaging WSDL
- Track the Delivery Status of an Outbound Message
- Integrating with the Force.com Platform
No comments:
Post a Comment