This content has been marked as final. Show 2 replies
Here is an article that has pretty much exactly what i want to do, in PHP.
Basically Salesforce can send a SOAP message when something happens. I want cold fusion to catch that soap message and save it.
I figured it out. For anyone else who is trying to use outbound messaging with Salesforce and Cold Fusion, this is how I did it. Turns out all you need is a page that does whatever you want it to do, and returns a simple soap envelope that says it completed. I almost feel like I should write a tutorial page or something, but maybe I'll do that later.
Since your getting SOAP data from Salesforce, use
<cfset SoapData = GetHttpRequestData()>
That saves everything you need to a variable. Then Parse the XML with
<CFSet xmlDoc = XMLParse(SoapData.Content)>
Now you have a nice package to read this crap with. You can do whatever you would want to with your XML data. I decided to read just a few needed pieces of info.
<cfset SFDATA.CCID = xmlDoc.Envelope.Body.Notifications.Notification.sObject.Child_Campaign__c.XmlText>
<cfset SFDATA.ID = xmlDoc.Envelope.Body.Notifications.Notification.sObject.ID.XmlText>
<cfset SFDATA.RID = xmlDoc.Envelope.Body.Notifications.Notification.sObject.Respondent__c.XmlText>
<cfset SFDATA.MCID = xmlDoc.Envelope.Body.Notifications.Notification.sObject.Master_Campaign__c.XmlText>
The other thing to note, for the trigger to work properly, Salesforce expects to receive a valid SOAP packet pack. Something that looks like
<?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">
<notifications xmlns=" http://soap.sforce.com/2005/09/outbound">
From what I can tell it must be the very first, and probably only thing returned. I put that at the top of my page, and wrapped the rest of my code in CFSilent to make sure nothing else was generated. Here is my full sample.
I hope this helps somebody out there. Took me a while to figure out.