0

I have been trying to figure this for a long time now, my issue is :

There is an outbound message that is being sent from a workflow rule (on create) with the Record Id, I want to capture this message in salesforce by exposing a Public (salesforce sites) service (SOAP), get the ID perform some business logic and return an OK response.

Not being able to get any lead in this direction; I came across this post here

which explains on using REST to retrieve the message and headers, I have manged to implement that part but now the catch is that I am not able to build/send an appropriate response to notify the server that the message is received (in short an OK response ) which causes the same message to be sent again and again.

I would appreciate any lead on either of the approaches, Thanks a Ton!

4

1 Answer 1

0

Finally I figured this out almost after two years, posting the solution so that anyone else stuck on this issue can find a way of doing this.

The goal here was to send the correct anticipated ack back to SFDC as a conformation that the Out-bound message has been received. The way to do that is to set your response body in the following way (the soap envelop is the important part):

res.responseBody = Blob.valueOf(
    '<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">' +
        '<soapenv:Body>' +
            '<notificationsResponse xmlns=\"http://soap.sforce.com/2005/09/outbound\">' +
                '<Ack>true</Ack>' +
            '</notificationsResponse>' +
        '</soapenv:Body>' +
    '</soapenv:Envelope>'
);

This does the job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .