-
Notifications
You must be signed in to change notification settings - Fork 0
/
outbound_message_handler.php
50 lines (35 loc) · 1.05 KB
/
outbound_message_handler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
include_once('./core/Logger.class.php');
function processSObject($pSObject) {
$id = $pSObject->Id;
Logger::dump("Inbound Message from SFDC: ID: $id");
//do something
$url = "http://www.acme.com/salesforce/sof/pdf.php?sof=$id";
//dispatch other page
$a = file_get_contents($url);
}
function ack($value) {
return array('Ack' => $value);
}
function notifications($data) {
//multiple notifications
if (is_array($data->Notification)) {
$result = array();
for ($i = 0; $i < count($data->Notification); $i++) {
processSObject($data->Notification[$i]->sObject);
array_push($result, ack(true));
}
return $result;
}
//single notification
else {
processSObject($data->Notification->sObject);
return ack(true);
}
}
// MAIN LOADER /////////////////////////////////////////
//load specific wsdl for outbound message handler
$server = new SoapServer("./wsdl/om.wsdl.xml");
$server->addFunction("notifications");
$server->handle();
?>