Index: . =================================================================== --- . (revision 11505) +++ . (working copy) @@ -61,6 +61,11 @@ protected $_classmap; /** + * Object registered with this server + */ + protected $_object; + + /** * Encoding * @var string */ @@ -483,6 +488,29 @@ } /** + * Attach an object to a server + * + * Accepts an instanciated object to use when handling requests. + * + * @param object $object + * @return Zend_Soap_Server + */ + public function setObject($object) + { + if(!is_object($object)) { + throw new Zend_Soap_Server_Exception('Invalid object argument ('.gettype($object).')'); + } + + if(isset($this->_object)) { + throw new Zend_Soap_Server_Exception('An object has already been registered with this soap server instance'); + } + + $this->_object = $object; + + return $this; + } + + /** * Return a server definition array * * Returns a list of all functions registered with {@link addFunction()}, @@ -652,6 +680,10 @@ call_user_func_array(array($server, 'setClass'), $args); } + if (!empty($this->_object)) { + call_user_func_array(array($server, 'setObject'), array($this->_object)); + } + return $server; }