note 103870 added to class.soapserver
| From: | JavierRomero at osu1 dot php dot net | Date: | Sat, 07 May 2011 22:26:05 +0000 |
| Subject: | note 103870 added to class.soapserver | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179532@lists.php.net to get a copy of this message | ||
This is to answer bug report: 36155
You can create an Abstract Soap Server by creating a class with the magic method __class() to handle
any request.
Of course, this isn't ideal in a web service world but it's a possible.
SERVER (AbstractSoap.php)
==================
<?php
// class
class AbstractSoap {
function __call($name, $args)
{
return array('Operation'=>$name, 'Arguments' => $args);
}
}
// start server
$server = new SoapServer(null, array('uri'=>'http://jromero.me/AbstractSoap'));
$server->setClass("AbstractSoap");
$server->handle();
?>
CLIENT (client.AbstractSoap.php)
==================
<?php
$client = new SoapClient(null,array(
"uri" => "http://jromero.me/AbstractSoap",
"location" => "http://someurl.com/AbstractSoap.php",
"trace" => 1,
"soap_version" => SOAP_1_1,
"exceptions" => 0)
);
$Authentication = new stdClass();
$Authentication->Username = 'user';
$Authentication->Password = 'password';
$Person = new stdClass();
$Person->FirstName = 'Javier';
$Person->LastName = 'Romero';
$response = $client->AddAccount($Authentication,$Person);
print_r($response);
?>
----
Server IP: 208.69.120.55
Probable Submitter: 69.149.42.103
----
Manual Page -- http://www.php.net/manual/en/class.soapserver.php
Edit -- https://master.php.net/note/edit/103870
Del: integrated -- https://master.php.net/note/delete/103870/integrated
Del: useless -- https://master.php.net/note/delete/103870/useless
Del: bad code -- https://master.php.net/note/delete/103870/bad+code
Del: spam -- https://master.php.net/note/delete/103870/spam
Del: non-english -- https://master.php.net/note/delete/103870/non-english
Del: in docs -- https://master.php.net/note/delete/103870/in+docs
Del: other reasons-- https://master.php.net/note/delete/103870
Reject -- https://master.php.net/note/reject/103870
Search -- https://master.php.net/manage/user-notes.php