setting up a listener is something that is quite easy and I have examples on this page, but I can help you get the data that you need.
So to get a basic listener setup here is the code that you need:
PHP Code:
//set this so your wsdl is not cached
ini_set("soap.wsdl_cache_enabled", "0");
//set this to receive the message from Salesforce
$data = fopen('php://input', 'rb');
//this gets the data and puts it into XML
$content = stream_get_contents($data);
//mail yourself the message to see what it looks like
mail('you@gmail.com', 'Salesforce outbound data', $content);
//checks to see if you have received a good message from Salesforce
//and then sends a true or false back to Salesforce to clear out the
//outbound message from the que
if ($content)
{
respond('true');
}
else
{
respond('false');
}
//function to respond to salesforce using the soap formatted message below
function respond($tf)
{
print '<?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">
<Ack>' . $tf . '</Ack>
</notifications>
</soapenv:Body>
</soapenv:Envelope>';
}
This is a basic setup. You will still need to consume the XML/SOAP message and format it so you.
I use a program that I purchased called Magic Parser > Magic Parser | PHP XML, RSS & CSV Parser
When you get the email with the outbound message, you can take it and go to the magic parser site and paste in the XML and it will generate the code for you. then you place that into your script and you can format it anyway you want to insert it into MySQL.
Hope that helps!!!
~Mike
Bookmarks