public function dispatch(Request &$request)
 {
     $config = ORBConfig::getInstance();
     for ($i = 0, $max = $request->getBodyCount(); $i < $max; $i++) {
         $request->setCurrentBody($i);
         $requestURI = $request->getRequestURI();
         if (LOGGING) {
             Log::log(LoggingConstants::INFO, "requestURI = {$requestURI}");
         }
         $serviceId = substr($requestURI, 0, strrpos($requestURI, "."));
         $methodName = substr($requestURI, strlen($serviceId) + 1);
         $arg = $request->getRequestBodyData();
         if (!is_array($arg)) {
             $arg = array($request->getRequestBodyData());
         }
         try {
             $value = self::handleInvoke($request, $serviceId, $methodName, $arg);
             $namedObject = $arg[0];
             $correlationId = $namedObject->defaultAdapt()->messageId;
             $ackMessage = new AckMessage($correlationId, null, $value);
             $request->setResponseBodyPart($ackMessage);
             $request->setResponseURI("/onResult");
         } catch (Exception $e) {
             $request->setResponseBodyPart($e);
             $request->setResponseURI("/onStatus");
         }
     }
     return true;
 }
Example #2
0
 public function dispatch(Request &$request)
 {
     $config = ORBConfig::getInstance();
     for ($i = 0, $max = $request->getBodyCount(); $i < $max; $i++) {
         $request->setCurrentBody($i);
         $requestURI = $request->getRequestURI();
         if (LOGGING) {
             Log::log(LoggingConstants::INFO, "requestURI = {$requestURI}");
         }
         $serviceId = substr($requestURI, 0, strrpos($requestURI, "."));
         $methodName = substr($requestURI, strlen($serviceId) + 1);
         $arg = $request->getRequestBodyData();
         if (!is_array($arg)) {
             $arg = array($request->getRequestBodyData());
         }
         if (LOGGING) {
             Log::log(LoggingConstants::DEBUG, "requestURI = {$requestURI}, " . "serviceId = {$serviceId}, methodName = {$methodName}, bodyDataType:" . gettype($request->getRequestBodyData()) . " className:" . get_class($request->getRequestBodyData()));
         }
         try {
             $value = self::handleInvoke($request, $serviceId, $methodName, $arg);
             $request->setResponseBodyPart($value);
             $request->setResponseURI("/onResult");
         } catch (Exception $e) {
             $request->setResponseBodyPart($e);
             $request->setResponseURI("/onStatus");
         }
     }
     return true;
 }