Exemplo n.º 1
0
 /**
  * Wrapper for logout
  * There is a max concurrent session allowance which if exceeded, will lock out the api user
  * Its IMPORTANT to logout in other words
  */
 public function logout()
 {
     $result = false;
     if (self::$isLoggedIn) {
         try {
             $loggedOut = self::$soapClient->logout();
             if ($this->debug == true) {
                 $this->print_xml();
             }
             if ($loggedOut->result == 1) {
                 self::$isLoggedIn = false;
                 self::$soapClient = null;
                 if ($this->debug == true) {
                     echo "Logged Out from sessionId : " . $this->sessionId . "\n";
                 }
                 $result = true;
             } else {
                 if ($this->debug == true) {
                     echo "Unable to perform logout";
                     $this->print_xml();
                 }
             }
         } catch (\Exception $ex) {
             self::$isLoggedIn = false;
             self::$soapClient = null;
             if ($this->debug == true) {
                 echo "Error logging out: " . $ex->getMessage();
             }
             throw $ex;
         }
     }
     return $result;
 }