return true; } // Arg order is brittle, assumes constant return ordering from eBay public function GetMemberMessages($Timestamp, $Ack, $CorrelationID, $Version, $Build, $NotificationEventName, $RecipientUserID, $MemberMessage, $PaginationResult, $HasMoreItems) { // Extract some data to prove this is working $UserID = $MemberMessage->MemberMessageExchange->Item->Seller->UserID; $this->carp($UserID); return $UserID; } public function GetItem($Timestamp, $Ack, $CorrelationID, $Version, $Build, $NotificationEventName, $RecipientUserID, $Item) { $ItemID = $Item->ItemID; return "OutBid: {$ItemID}"; } } $config = parse_ini_file('ebay.ini', true); $site = 'sandbox'; $dev = $config[$site]['devId']; $app = $config[$site]['appId']; $cert = $config[$site]['cert']; // Create and configure session $session = new eBaySession($dev, $app, $cert); error_log(serialize(apache_request_headers())); //error_log("trying to listen"); $stdin = $GLOBALS['HTTP_RAW_POST_DATA']; //file_put_contents('GetItemRequest.xml', $stdin); error_log($stdin); $server = new SOAPServer(null, array('uri' => 'urn:ebay:apis:eBLBaseComponents')); $server->setClass('eBayPlatformNotificationListener', $session, true); $server->handle();
<?php /* ** Пример простого сервера SOAP */ // Текущее время на сервере function getTime() { return date('H:i:s'); } // Привествие пользователя function sayHello($userName) { return 'Привет, ' . $userName . '!'; } // SOAP Server ini_set("soap_wsdl_cache_enabled", "0"); $server = new SOAPServer('server.wsdl'); $server->addFunction(array('getTime', 'sayHello')); // Обработка запроса $server->handle();
class Carro { private $pdo; public function __construct() { $this->pdo = new PDO("mysql:host=localhost;dbname=carro", 'root', ''); } public function setMovimento($movimento) { $this->pdo->query('INSERT INTO movimento(tipo) VALUES(' . (int) $movimento . ')'); return $movimento; } public function getMovimentos($id) { $sql = $this->pdo->prepare('SELECT * FROM movimento WHERE id > ' . (int) $id . ' AND time BETWEEN timestamp(DATE_SUB(NOW(), INTERVAL 5 MINUTE)) AND timestamp(NOW()) LIMIT 100'); $sql->execute(); $movimentos = $sql->fetchAll(); return $movimentos; } } try { $server = new SOAPServer(NULL, array('uri' => 'http://199.168.139.21/carro/server.php')); $server->setClass('Carro'); $server->handle(); } catch (SOAPFault $f) { print $f->faultstring; }
<?php require_once 'MyClass.php'; try { $server = new SOAPServer(NULL, array('uri' => 'http://localhost/soap/server.php')); $server->setClass('MyClass'); $server->handle(); } catch (SOAPFault $f) { print $f->faultstring; }
<?php /* ** Сервер работы с БД книги */ require 'server.functions.php'; ini_set("soap_wsdl_cache_enabled", "0"); $server = new SOAPServer('bookservice.wsdl'); $server->addFunction($serverFunctions); $server->handle();