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
Maneesh Gupta 11Maneesh Gupta 11 

Reading outbound messages

Hello,

I have an integration requirement where an external SFDC application to going to send me outbound messages which I need to read and process in my SFDC application.
I am wondering how can I read the outbound messages? Can I write Apex webservice? Will that work?
SKolakanSKolakan
You can create a rest endpoint and you can make your external application post to it. Please see this link on how to create REST endpoint.
https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST
 
john yungkjohn yungk
Maneesh,

I haven't done it, but I think it can be done. I would start be looking at Apex SOAP services:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_web_services.htm

Then I would look at generating the Apex method from the WSDL that would be available from the outbound message
https://help.salesforce.com/HTViewHelpDoc?id=code_wsdl_to_package.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=code_wsdl_to_package.htm&language=en_US)

Good luck,
John
Maneesh Gupta 11Maneesh Gupta 11
Hello Sreeni and John,

Thanks for your response! Once we create REST/SOAP services/end points, how would I make sure that as soon as an outbound message is posted at that end point, the web service is invoked and the Apex method is executed?

This is a real time requirement. So I want to execute the Apex method (web service) as soon as the outbound message is received. How can I do this?
john yungkjohn yungk
The fact that the Apex Web Service you would be exposing is a web service, it would be invoked real-time when the outbound message is sent from the external Salesforce application. But please note that outbound messages sent from the external Salesforce application will be sent asyncronously. Salesforce queues outbound messages and sends them when resources are available, so sometimes this will be almost immediately, but other times this can be longer.

I would suggest reviewing Understanding Notifications (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_om_outboundmessaging_notifications.htm) in the Developers Guide.

John
Maneesh Gupta 11Maneesh Gupta 11
Thanks John! I really appreciate!
Maneesh Gupta 11Maneesh Gupta 11
Hello,

I have another related question here. Once the source SFDC org posts an outbound message to an end point, how can I parse that message? I have to consume that message and store the information in my Org.
Can I write an Apex class to parse and process that outbound message?
john yungkjohn yungk
After you define the outbound message, a WSDL will be made available. You should be able to use this to create the Apex class, but again, I haven't consumed an outbound message in Salesforce, only external applications.

Good luck,
John