Exemplo n.º 1
0
 public function __call($name, $arguments)
 {
     $b = Kwf_Benchmark::start('soapCall', $name);
     $ret = parent::__call($name, $arguments);
     if ($b) {
         $b->stop();
     }
     return $ret;
 }
Exemplo n.º 2
0
 public function __call($method, $args)
 {
     $log = date('Y-m-d H:i:s') . " (start) {$this->_serverUrl} {$method} " . Kwf_Setup::getRequestPath() . "\n";
     file_put_contents('log/srpc-call', $log, FILE_APPEND);
     $start = microtime(true);
     $b = Kwf_Benchmark::start('srpc call', $this->_serverUrl . ' ' . $method);
     $params = array('method' => $method, 'arguments' => array(), 'extraParams' => array());
     if (is_array($args) && count($args)) {
         $params['arguments'] = $args;
     }
     if ($this->_extraParams) {
         $params['extraParams'] = $this->_extraParams;
     }
     $params['arguments'] = serialize($params['arguments']);
     $params['extraParams'] = serialize($params['extraParams']);
     if (strpos($params['arguments'], 'Kwf_') !== false || strpos($params['extraParams'], 'Kwf_') !== false) {
         $ex = new Kwf_Exception("a class name with 'Kwf_' must not be sent through srpc client");
         $ex->logOrThrow();
     }
     $response = $this->_performRequest($params);
     $log = date('Y-m-d H:i:s') . ' ' . round(microtime(true) - $start, 2) . "s {$this->_serverUrl} {$method} " . Kwf_Setup::getRequestPath() . "\n";
     file_put_contents('log/srpc-call', $log, FILE_APPEND);
     if ($b) {
         $b->stop();
     }
     try {
         $result = unserialize($response);
     } catch (Exception $e) {
         throw new Kwf_Exception('Srpc Server Response is not serialized: ' . $response);
     }
     if ($result === false) {
         throw new Kwf_Exception('Srpc Server Response is not serialized: ' . $response);
     }
     // result könnte eine Exception sein, wenn ja wird sie weitergeschmissen
     if ($result instanceof Kwf_Exception_Serializable) {
         throw $result->getException();
     } else {
         if ($result instanceof Exception) {
             throw $result;
         }
     }
     return $result;
 }