Req #36155 [Opn->Wfx]: SoapServer: Possibility to have ONE function that handles all Soap requests

From: Date: Mon, 20 Sep 2021 14:56:15 +0000
Subject: Req #36155 [Opn->Wfx]: SoapServer: Possibility to have ONE function that handles all Soap requests
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236715@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36155&edit=1 ID: 36155 Updated by: cmb@php.net Reported by: tschlottke at virtualminds dot de Summary: SoapServer: Possibility to have ONE function that handles all Soap requests -Status: Open +Status: Wont fix Type: Feature/Change Request Package: SOAP related Operating System: irrelevant PHP Version: 5.1.2 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: After 15 years without any feedback, except for a comment that shows that this is already possible, I think we can close this as WONTFIX. Previous Comments: ------------------------------------------------------------------------ [2011-05-08 00:18:10] j dot romero dot 1214 at gmail dot com 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",)); $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); ?> ------------------------------------------------------------------------ [2006-01-25 10:31:14] tschlottke at virtualminds dot de Description: ------------ It would be neat to implmentent a method to register ONE function that handles everything, no matter which function the client called. This function could then do (for example) Session/Authentification-related stuff. The soapserver should forward all parameters(as array) aswell as the function name called by the client(and maybe the namespace) and return all values returned by this function. So this function could handle it all. Would be a neat thing... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=36155&edit=1

« previous php.bugs (#236715) next »