Version 2 by Gavin
on Sep 05, 2006 21:11.

compared with
Current by Bill Karwin
on Oct 07, 2006 21:18.

This line was removed.
This word was removed. This word was added.
This line was added.

Changes (15)

View Page History
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:review-end}August 31, 2006{zone-data}

Zend_XmlRpc_Session Zend_XmlRpc_Server

Zend_XmlRpc_Server provides a flexible, performant, UTF-8 aware, and easily implemented XMLRPC server following PHP's SOAP Server API. It features the ability to attach functions, static methods, and object instance methods as XMLRPC method callbacks; the ability to cache a server definition to accelerate future calls to the server; and auto-creation of method help text and signatures via introspection of the callbacks used.

All required system.* methods are implemented in the server, including system.listMethods, system.methodHelp, and system.methodSignature. Additionally, the system.multicall method has been included to allow method boxcarring in a single request.
the system.multicall method has been included to allow method boxcarring in a single request.

This component was developed internally at Zend prior to the original preview releases and as such has not followed the now established community process. It is being opened to public comment after initial commit to the incubator.

Zend_XmlRpc_Server allows the developer to attach any combination of functions, classes, and objects to the server as XMLRPC method callbacks, each with an optional namespace. The developer need only provide the function name, class name, or object to the appropriate methods (addFunction() and setClass()); the resource is then examined via PHP 5's Reflection API to determine the signature and method help (if a docblock is present). (Note: this introspection has been moved to Zend_Server_Reflection.)

Method boxcarring is allowed via the system.multicall method.

After methods are attached, the handle() method may be called. It accepts an optional XML string representing the XMLRPC request; if none is passed, the server attempts to retrieve it via php://input. The request is parsed for a valid methodName and arguments, and an XML response is returned; the response is an XMLRPC fault response in the event of an error.
After methods are attached, the handle() method should be called. It accepts an optional request object representing the XMLRPC request; if none is passed, the server instantiates a Zend_XmlRpc_Request_Http object to retrieve it via php://input. Request objects should provide accessors for retrieving the method (getMethod()) and arguments (getParams()).

A response object is returned by handle(); the response object will be either a Zend_XmlRpc_Response or a Zend_XmlRpc_Server_Fault, either of which may be directly echoed in order to generate the XML response, or further manipulated by the instance script (for instance, to log returns). The developer may set the type of response object returned by using setResponseType(); by default, a Zend_XmlRpc_Response_Http is returned, which will set the appropriate HTTP content type when echoed.

Optionally, the developer may cache the dispatch table for future invocations, thus eliminating the need to attach and inspect method callbacks. Zend_XmlRpc_Server_Cache provides basic functionality for this, currently serializing the dispatch table and saving it to disk. When caching, one must either load all classes that could be called, or rely on __autoload().

By default, only Zend_XmlRpc_Server_Exceptions may be used to provide messages and codes for use with fault responses. However, the developer may register additional exception types for use with faults using Zend_XmlRpc_Server_Fault::attachFaultException(). Additionally, the developer may observe faults for the purpose of logging or messaging by attaching observers via Zend_XmlRpc_Server_Fault::attachObserver().

Convenience methods are presented for accessing the last request and response, both as XML and as native PHP structures.


* Zend_XmlRpc_Fault
* Zend_XmlRpc_Request
* Zend_XmlRpc_Request_Http
* Zend_XmlRpc_Request_Stdin
* Zend_XmlRpc_Response
* Zend_XmlRpc_Response_Http
* Zend_XmlRpc_Server
* Zend_XmlRpc_Server_Cache
* Zend_XmlRpc_Server_Exception
* Zend_XmlRpc_Server_Fault
* Zend_XmlRpc_Server_CallbackParser_Core
* Zend_XmlRpc_Server_CallbackParser_Array
* Zend_XmlRpc_Server_CallbackParser_Class
* Zend_XmlRpc_Server_CallbackParser_Function
* Zend_XmlRpc_Server_CallbackParser_Object


// Handle request
$response = echo $server->handle();
echo $response;