Yesterday I came across a major problem with one of our outbound soap processes that I would like to bring up.
I knew that Salesforce assigned a processing Id with their outbound message, which makes since. I always thought that this was a 1 for 1 relationship, but I am totally mistaken.
We had a discrepancy in some of our counts in two different objects and could not figure it out. Further testing revealed that Salesforce can send multiple records with one processing Id. Look at the XML code below from one processing Id:
Code:
<?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>*****************</OrganizationId>
<ActionId>04k400000004CYMAA2</ActionId>
<SessionId xsi:nil="true"/>
<EnterpriseUrl>https://cs2-api.salesforce.com/services/Soap/c/8.0/</EnterpriseUrl>
<PartnerUrl>https://cs2-api.salesforce.com/services/Soap/u/8.0/</PartnerUrl>
<Notification>
<Id>04lR00000004z4uIAA</Id>
<sObject xsi:type="sf:OpportunityLineItem" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>00k40000004PHXtAAO</sf:Id>
</sObject>
</Notification>
<Notification>
<Id>04lR00000004z4qIAA</Id>
<sObject xsi:type="sf:OpportunityLineItem" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>00k40000004P5IhAAK</sf:Id>
</sObject>
</Notification>
<Notification>
<Id>04lR00000004z4vIAA</Id>
<sObject xsi:type="sf:OpportunityLineItem" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>00k40000004PK51AAG</sf:Id>
</sObject>
</Notification>
</soapenv:Body>
</soapenv:Envelope>
I wrote the script on the basis of the 1 to 1 relationship and hence, it could not. I will rewrite it on Monday morning so it can iterate through multiple line items and process all the SOAP inbound messages. This will allow for mutliple records to process
Just be aware that there is a 1 to many relationship when it comes to SOAP messages from Salesforce and adjust your processes accordingly.
I will keep this thread updated with the changes and let you know how it goes
~Mike