示例#1
0
 public function authenticate($userName, $password)
 {
     // TODO need to handle exceptions!
     $authenticationService = WebServiceFactory::getAuthenticationService($this->_connectionUrl);
     $result = $authenticationService->startSession(array("username" => $userName, "password" => $password));
     // Get the ticket and sessionId
     $ticket = $result->startSessionReturn->ticket;
     $sessionId = $result->startSessionReturn->sessionid;
     // Store the session id for later use
     if ($sessionId != null) {
         $sessionIds = null;
         if (isset($_SESSION["sessionIds"]) == false) {
             $sessionIds = array();
         } else {
             $sessionIds = $_SESSION["sessionIds"];
         }
         $sessionIds[$ticket] = $sessionId;
         $_SESSION["sessionIds"] = $sessionIds;
     }
     return $ticket;
 }