I would like to configure an outbound message in standard workflow to send a SOAP message to a Salesforce Apex webservice listener. I have seen documentation on how to implement a SOAP listener in other languages but not Apex. I believe the imported outbound message WSDL class would need to be an interface and a webservice would need exposed to implement that interface. The outbound message would also be sent from the same Salesforce org as the receiving listener handling the message.

Any ideas on how to convert the outbound message WSDL into an Apex listener? I tried importing the WSDL which created 3 classes and exposing one of the classes as a webservice which represented the endpoint of the outbound workflow. The result was that the Session ID was invalid even though I configured the outbound message to include the session Id.
It appears the seesion Id is being passed in the message body and not the header which is needed for authentication. I'm not sure how to get around that.

Example of the webservice tested:

global class WebserviceTest {

    webservice static Boolean notifications(String OrganizationId,String ActionId,String SessionId,String EnterpriseUrl,String PartnerUrl,OutboundMessage.ContactNotification[] Notification){
        insert new Lead(LastName = Notification[0].sObject_x.FirstName);

        return true;

1 Answer 1


As you have found, the outbound message callout isn't able to pass the current session ID in the format required for the Salesforce hosted web service.

The SessionId this is passed is a parameter rather than a header as required by the webService keyword.

Instead, you can host the Apex web service in a public Force.com Sites instance. This would bypass the need for the Session ID header. Add the class containing the webservice to the Public Access Settings for the Site.

If you want, you could use a separate web service for the site that uses the SessionId from the request to call the secured web service. However, by this stage things are getting a bit ugly with the request bouncing along from outbound message to Sites web service to secured web service.

See also:

  • Thanks for the feedback. I discovered the public site option yesterday during some research but it will not be an option for the use case given to me (managed package involved). That's all ok because I have come up with a different solution not requiring an outbound message.
    – Joe
    Commented Sep 9, 2014 at 16:45
  • 1
    @Joe , if this does still answer the question you originally asked, do please accept it as an answer. Commented Mar 23, 2015 at 23:00

You must log in to answer this question.

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