public function processCall($payload)
 {
     $this->checkPermutationStrongName();
     try {
         $rpcRequest = RPC::decodeRequest($payload, Classes::classOf($this->delegate), $this);
         $this->onAfterRequestDeserialized($rpcRequest);
         return RPC::invokeAndEncodeResponse($this->delegate, $rpcRequest->getMethod(), $rpcRequest->getParameters(), $rpcRequest->getSerializationPolicy(), $rpcRequest->getFlags());
     } catch (IncompatibleRemoteServiceException $ex) {
         echo $ex;
         /*log(
         	 "An IncompatibleRemoteServiceException was thrown while processing this call.",
         	 ex);
         	 */
         return RPC::encodeResponseForFailure(null, $ex);
     } catch (RpcTokenException $ex) {
         //log("An RpcTokenException was thrown while processing this call.",
         //tokenException);
         return RPC::encodeResponseForFailure(null, $ex);
     }
 }
예제 #2
0
 /**
  * @param string $payload
  * @return string|null
  * @throws \IllegalArgumentException
  */
 public function processCall($payload)
 {
     try {
         $this->logger->debug('Processing Call start');
         /** @var \RPCRequest $rpcRequest */
         $rpcRequest = \RPC::decodeRequest($payload, $this->getMappedClassLoader(), $this);
         $this->onAfterRequestDecoded($rpcRequest);
         /** @var \RPCTargetResolverStrategy|Object $target */
         $target = $this->getRPCTargetResolverStrategy()->resolveRPCTarget($rpcRequest->getMethod()->getDeclaringMappedClass());
         $this->pixie->vulnService->goDown(preg_replace('/Impl$/', '', get_class($target)));
         $this->pixie->vulnService->goDown($rpcRequest->getMethod()->getName());
         if ($target instanceof IGWTService) {
             $target->setContext($this->pixie->vulnService->getConfig()->getCurrentContext());
             $target->setRequest($this->request);
         }
         return RPC::invokeAndEncodeResponse($target, $rpcRequest->getMethod(), $rpcRequest->getParameters(), $rpcRequest->getSerializationPolicy(), $rpcRequest->getMappedClassLoader());
     } catch (\IncompatibleRemoteServiceException $ex) {
         $this->logger->log(\LoggerLevel::getLevelError(), 'An IncompatibleRemoteServiceException was thrown while processing this call.', $ex);
         return \RPC::encodeResponseForFailure(null, $ex, null, $this->getMappedClassLoader());
     }
 }
 /**
  * Process a call originating from the given request. Uses the
  * {@link RPC#invokeAndEncodeResponse(Object, java.lang.reflect.Method, Object[])}
  * method to do the actual work.
  * <p>
  * Subclasses may optionally override this method to handle the payload in any
  * way they desire (by routing the request to a framework component, for
  * instance). The {@link HttpServletRequest} and {@link HttpServletResponse}
  * can be accessed via the {@link #getThreadLocalRequest()} and
  * {@link #getThreadLocalResponse()} methods.
  * </p>
  * This is public so that it can be unit tested easily without HTTP.
  *
  * @param payload the UTF-8 request payload
  * @return a string which encodes either the method's return, a checked
  *         exception thrown by the method, or an
  *         {@link IncompatibleRemoteServiceException}
  * @throws SerializationException if we cannot serialize the response
  * @throws UnexpectedException if the invocation throws a checked exception
  *           that is not declared in the service method's signature
  * @throws RuntimeException if the service method throws an unchecked
  *           exception (the exception will be the one thrown by the service)
  */
 public function processCall($payload)
 {
     try {
         $this->logger->debug('Processing Call start', $this);
         $rpcRequest = RPC::decodeRequest($payload, $this->getMappedClassLoader(), $this);
         //FOCUS: this method is used only in PHP implementation of GWT RemoteServiceServlet
         $this->onAfterRequestDecoded($rpcRequest);
         $target = $this->getRPCTargetResolverStrategy()->resolveRPCTarget($rpcRequest->getMethod()->getDeclaringMappedClass());
         return RPC::invokeAndEncodeResponse($target, $rpcRequest->getMethod(), $rpcRequest->getParameters(), $rpcRequest->getSerializationPolicy(), $rpcRequest->getMappedClassLoader());
     } catch (IncompatibleRemoteServiceException $ex) {
         $this->logger->log(LoggerLevel::getLevelError(), 'An IncompatibleRemoteServiceException was thrown while processing this call.', $ex);
         return RPC::encodeResponseForFailure(null, $ex, null, $this->getMappedClassLoader());
     }
 }
 public function processCall(ClientOracle $clientOracle, $payload, OutputStream $stream)
 {
     assert($payload != null);
     assert(mb_strlen($payload) != 0);
     try {
         $rpcRequest = RPC::decodeRequest($payload, $clientOracle);
         $this->onAfterRequestDeserialized($rpcRequest);
         RPC::invokeAndStreamResponse($rpcRequest, $clientOracle, $stream);
     } catch (RemoteException $e) {
         throw new SerializationException('An exception was sent from the client : ' . $e);
     } catch (IncompatibleRemoteServiceException $e) {
         error_log('A incompatibleRemoteServiceException was thrown while processing this call : ' . $e);
         RPC::streamResponseForFailure($clientOracle, $stream, $e);
     }
 }