public function lookupProxy($lookupName, $sessionId = null)
{
// initialize the remote method call parser and the session storage
$sessions = new ArrayList();
// initialize the local context connection
$connection = new DoctrineLocalContextConnection();
$connection->injectSessions($sessions);
$connection->injectApplication($this->getApplication());
// initialize the context session
$session = $connection->createContextSession();
// check if we've a HTTP session ID passed
if ($sessionId == null) {
// simulate a unique session ID
$session->setSessionId(SessionUtils::generateRandomString());
} else {
// else, set the passed session ID
$session->setSessionId($sessionId);
}
// lookup and return the requested remote bean instance
return $session->createInitialContext()->lookup($lookupName);
}