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
PrafPraf 

Help needed in extracting payload from Outbound Msg notifications

Hello ... I recently set up an outbound msg notification on our org and set up an end point, which is basically a listener as outlined in the APIs. However, I need to pass this payload onto another internal web service which is expecting a string rather than a SOAP msg. I have tried researching this online and in the forums but couldnt find any ones that detail how to do that. Almost everyone is going old school and extracting the payload and generating your own SOAP msg be it on PHP or .Net. Is there any built in stubs or methods that will spit out a String representation or XML representation of the incoming request? I have tried to access the request and casting it to a String but it didnt seem to like it.

 

Here is what I am doing:

 

 

public com.sforce.soap.x2005.x09.outbound.NotificationsResponse notifications( com.sforce.soap.x2005.x09.outbound.Notifications request) { NotificationsResponse response = new NotificationsResponse(); String myCompany = request.getNotification()[0].getSObject().getCompany_Name__C(); System.out.println("Company Name: " + myCompany);

 

 Also, is there a sample of the SOAP msg coming in so that I can atleast create my own msg and massage the data if needed.

Any help would be appreciated.

 

Frederic75Frederic75

It looks something like that:

 

<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <notifications xmlns="http://soap.sforce.com/2005/09/outbound"> <OrganizationId>00D80000000MIm9EAG</OrganizationId> <ActionId>04k800000008PghAAE</ActionId> <SessionId>511900D80000000MIm9!ARUAQP1U9xlJ9BPHhHaWg28aXWEUd1BOOoBPCoKj..SpfQp9BBYo7yKIf8ARSHwDvqvxNZrcWx7PXvdLJ9cG9HM92QhY5.f8</SessionId> <EnterpriseUrl>https://na6-api.salesforce.com/services/Soap/c/8.0/511900D80000000MIm9</EnterpriseUrl> <PartnerUrl>https://na6-api.salesforce.com/services/Soap/u/8.0/511900D80000000MIm9</PartnerUrl> <Notification> <Id>04l80000002UmA9AAK</Id> <sObject xsi:type="sf:Product2" xmlns:sf="urn:sobject.enterprise.soap.sforce.com"> <sf:Id>01t80000001GnCwAAK</sf:Id> <sf:Name>Fraud Alert 1234</sf:Name> </sObject> </Notification> </notifications> </soapenv:Body> </soapenv:Envelope>