Ejemplo n.º 1
0
 /**
  * Set up zend service class - mainly about fault handling
  *
  * @return void
  */
 protected function init_zend_server()
 {
     parent::init_zend_server();
     // this exception indicates request failed
     Zend_XmlRpc_Server_Fault::attachFaultException('WebserviceException');
     Zend_XmlRpc_Server_Fault::attachFaultException('MaharaException');
     Zend_XmlRpc_Server_Fault::attachFaultException('UserException');
     Zend_XmlRpc_Server_Fault::attachFaultException('NotFoundException');
     Zend_XmlRpc_Server_Fault::attachFaultException('SystemException');
     Zend_XmlRpc_Server_Fault::attachFaultException('InvalidArgumentException');
     Zend_XmlRpc_Server_Fault::attachFaultException('AccessDeniedException');
     Zend_XmlRpc_Server_Fault::attachFaultException('ParameterException');
     Zend_XmlRpc_Server_Fault::attachFaultException('WebserviceParameterException');
     Zend_XmlRpc_Server_Fault::attachFaultException('WebserviceInvalidParameterException');
     Zend_XmlRpc_Server_Fault::attachFaultException('WebserviceInvalidResponseException');
     if (ws_debugging()) {
         Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
     }
 }
Ejemplo n.º 2
0
 /**
  * Set up zend service class
  * @return void
  */
 protected function init_zend_server()
 {
     parent::init_zend_server();
     if ($this->authmethod == WEBSERVICE_AUTHMETHOD_USERNAME) {
         $username = param_variable('wsusername', '');
         $password = param_variable('wspassword', '');
         // aparently some clients and zend soap server does not work well with "&" in urls :-(
         //TODO: the zend error has been fixed in the last Zend SOAP version, check that is fixed and remove obsolete code
         $url = get_config('wwwroot') . 'webservice/soap/server.php/' . urlencode($username) . '/' . urlencode($password);
         // the Zend server is using this uri directly in xml - weird :-(
         $this->zend_server->setUri(htmlspecialchars($url));
     } else {
         $wstoken = param_variable('wstoken', '');
         $url = get_config('wwwroot') . 'webservice/soap/server.php?wstoken=' . urlencode($wstoken);
         // the Zend server is using this uri directly in xml - weird :-(
         $this->zend_server->setUri(htmlspecialchars($url));
     }
     if (!param_boolean('wsdl', 0)) {
         $this->zend_server->setReturnResponse(true);
         //TODO: the error handling in Zend Soap server is useless, XML-RPC is much, much better :-(
         $this->zend_server->registerFaultException('MaharaException');
         $this->zend_server->registerFaultException('UserException');
         $this->zend_server->registerFaultException('NotFoundException');
         $this->zend_server->registerFaultException('SystemException');
         $this->zend_server->registerFaultException('InvalidArgumentException');
         $this->zend_server->registerFaultException('AccessDeniedException');
         $this->zend_server->registerFaultException('ParameterException');
         $this->zend_server->registerFaultException('WebserviceException');
         $this->zend_server->registerFaultException('WebserviceParameterException');
         //deprecated - kept for backward compatibility
         $this->zend_server->registerFaultException('WebserviceInvalidParameterException');
         $this->zend_server->registerFaultException('WebserviceInvalidResponseException');
         $this->zend_server->registerFaultException('WebserviceAccessException');
         if (ws_debugging()) {
             $this->zend_server->registerFaultException('SoapFault');
         }
     }
 }