Re: [PEPr] Comment on XML::XML_RPC2
| From: | Davey | Date: | Sat, 06 Nov 2004 02:01:30 +0000 |
| Subject: | Re: [PEPr] Comment on XML::XML_RPC2 | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34221@lists.php.net to get a copy of this message | ||
Davey Shafik wrote:
Davey Shafik (http://pear.php.net/user/davey) has commented on the proposal for XML::XML_RPC2. Comment: I'd like to see more examples, and I don't understand what method the client example is calling. Is it calling the "test" method with "PEAR_Server" as the argument, or is "PEAR_Server" the method and "test" lord knows what? Also, I'd like to see examples of docblocked classes which have methods with arguments, and a breakdown of what is used to expose it. I'd like it possible if we could collaborate on some sort of API to make it possible to expose the same code automatically as SOAP (through Crtx_SOAP) or XML-RPC, thoughts? Finally, the version should be 0.x.x, 2.0.0 will be the first stable release :) Would you like a third developer? :) - Davey Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=172On further inspection, I see quite a number of problems, and have a few ideas :) XML_RPC2_Server::$_methodHandler property is public yet starts with a _... very confusing, choose one or the other ;) Also, I don't like that whatever class you want to expose must extend XML_RPC2_Server_MethodHandler... this isn't automated code -> XML-RPC INSHO. I think that the automation should be as easy with XML_RPC2 as it is with Crtx_SOAP - take any code and expose it. I also think that following the ext/soap API is needed, really. $xml_rpc_server = new XML_RPC2_Server; $xml_rpc_server->setClass('foo'); this will do whatever needs to be done to find the methods in the class and automatically map them to the server via __call() Additionally, by having a special handler, you can mimic the: SoapServer::addFunction() method. I was writing this addFunction handler when I stumbled across the stupid (IMO) extending of XML_RPC2_Server_MethodHandler. I think this is a good start, I just think you need to become consistent with ext/soap for this to have any success. I understand that one of the difficulties with XML-RPC is its tendendancy to use foo.bar syntax, which we can't use like: $client->foo.bar(args...); Are you doing $client->foo_bar() ? Or is this the weird $client->test('PEAR_Server') ?? i.e. $client->foo('bar'); ? Personally, I would use the _ to . translation except it might intefere with methods actually called foo_bar, I think a $client->call() for these rarer cases would be preferable. Think about being able to take any piece of code, and exposing it as SOAP or XML-RPC. I envision this: example.com/helloWorld.php?soap // expose it as a SOAP Server (handled by Crtx_SOAP) example.com/helloWorld.php?xmlrpc // expose it as a XML-RPC Server (handled by XML_RPC2) example.com/helloWorld.php?wsdl // show the WSDL for the server (only useful to SOAP, and handled by Crtx_SOAP) example.com/helloWorld.php?docs&wsdl or ?docs&soap // show basic docs (handled by the current server, means types and such are correct) Anyways, I want it to be this damn easy: 1) Write my code. 2) Use it on my site as a PHP class 3) Decide expose as SOAP/XML-RPC 4) Write 4 lines of code, telling the relevant class what to export 5) Done. I think if you guys (with my help if you want it) mimi ext/soap, I will do the same as I did for ext/soap with Crtx_SOAP - Davey