Beispiel #1
0
 /**
  * Will process the login.
  *
  * If successful, will set the session and cluster information
  * to the class
  *
  * @since 0.0.1
  *
  * @access public
  * @return boolean If successful or not
  * @throws \Pronamic\Twinfield\LoginException
  */
 public function process()
 {
     // Process logon
     if ($this->config->getClientToken() != '') {
         $response = $this->soapLoginClient->OAuthLogon($this->config->getCredentials());
         $result = $response->OAuthLogonResult;
     } else {
         $response = $this->soapLoginClient->Logon($this->config->getCredentials());
         $result = $response->LogonResult;
     }
     // Check response is successful
     if ($result == 'Ok') {
         // Response from the logon request
         $this->loginResponse = $this->soapLoginClient->__getLastResponse();
         // Make a new DOM and load the response XML
         $envelope = new \DOMDocument();
         $envelope->loadXML($this->loginResponse);
         // Gets SessionID
         $sessionID = $envelope->getElementsByTagName('SessionID');
         $this->sessionID = $sessionID->item(0)->textContent;
         // Gets Cluster URL
         $cluster = $envelope->getElementsByTagName('cluster');
         $this->cluster = $cluster->item(0)->textContent;
         // This login object is processed!
         $this->processed = true;
         return true;
     }
     throw new LoginException("Login error: " . $result);
 }
Beispiel #2
0
 /**
  * Will process the login.
  *
  * If successful, will set the session and cluster information
  * to the class
  *
  * @since 0.0.1
  *
  * @access public
  * @return boolean If successful or not
  */
 public function process()
 {
     // Process logon
     $response = $this->soapLoginClient->Logon($this->config->getCredentials());
     // Check response is successful
     if ('Ok' == $response->LogonResult) {
         // Response from the logon request
         $this->loginResponse = $this->soapLoginClient->__getLastResponse();
         // Make a new DOM and load the response XML
         $envelope = new \DOMDocument();
         $envelope->loadXML($this->loginResponse);
         // Gets SessionID
         $sessionID = $envelope->getElementsByTagName('SessionID');
         $this->sessionID = $sessionID->item(0)->textContent;
         // Gets Cluster URL
         $cluster = $envelope->getElementsByTagName('cluster');
         $this->cluster = $cluster->item(0)->textContent;
         // This login object is processed!
         $this->processed = true;
         return true;
     }
     return false;
 }