示例#1
0
 /**
  * Fetches the user's transcript from the server and returns it.
  * @return array user's transcript as returned by PowerSchool
  */
 public function fetchTranscript()
 {
     $client = new \Zend\Soap\Client();
     $client->setOptions(array('uri' => 'http://publicportal.rest.powerschool.pearson.com/xsd', 'location' => $this->soap_url . 'pearson-rest/services/PublicPortalServiceJSON', 'login' => 'pearson', 'password' => 'm0bApP5', 'use' => SOAP_LITERAL));
     // This is a workaround for SoapClient not having a WSDL to go off of.
     // Passing everything as an object or as an associative array causes
     // the parameters to not be correctly interpreted by PowerSchool.
     $parameters = array('userSessionVO' => (object) array('userId' => $this->soap_session->userId, 'serviceTicket' => $this->soap_session->serviceTicket, 'serverInfo' => (object) array('apiVersion' => $this->soap_session->serverInfo->apiVersion), 'serverCurrentTime' => '2012-12-26T21:47:23.792Z', 'userType' => '2'), 'studentIDs' => $this->soap_session->studentIDs, 'qil' => (object) array('includes' => '1'));
     $transcript = $client->__call('getStudentData', $parameters);
     return $transcript;
 }
示例#2
-1
 /**
  * Attempt to authenticate against the server
  * @param string $url URL for the PowerSchool server to authenticate against
  * @param string $username student's username
  * @param string $password student's password
  * @param boolean $fetch_transcript fetch transcript after successful login?
  * @return PowerAPI\Student
  */
 public static function authenticate($url, $username, $password, $fetch_transcript = true)
 {
     // Ensure the URL ends with a /
     if (substr($url, -1) !== "/") {
         $url = $url . "/";
     } else {
         $url = $url;
     }
     $client = new \Zend\Soap\Client();
     $client->setOptions(array('uri' => 'http://publicportal.rest.powerschool.pearson.com/xsd', 'location' => $url . 'pearson-rest/services/PublicPortalServiceJSON', 'login' => 'pearson', 'password' => 'm0bApP5', 'use' => SOAP_LITERAL));
     $login = $client->__call('login', array('username' => $username, 'password' => $password, 'userType' => 2));
     // userSessionVO is unset if something went wrong during auth.
     if ($login->userSessionVO === null) {
         throw new Exceptions\Authentication($login->messageVOs->description);
     }
     $session = $login->userSessionVO;
     return new Data\Student($url, $session, $fetch_transcript);
 }
示例#3
-1
文件: Soap.php 项目: bradley-holt/zf2
 /**
  * Perform a SOAP call but first check for adding STS Token or fetch one
  *
  * @param string $name
  * @param array  $arguments
  * @return mixed
  */
 public function __call($name, $arguments)
 {
     /**
      * add WSSE Security header
      */
     if ($this->_tokenService !== null) {
         // if login method we addWsseLoginHeader
         if (in_array('login', $arguments)) {
             $this->addWsseLoginHeader();
         } elseif ($name == 'getTokens') {
             $this->addWsseTokenHeader($this->_tokenService->getLoginToken());
         } else {
             $this->addWsseSecurityTokenHeader($this->_tokenService->getTokens());
         }
     }
     return parent::__call($name, $arguments);
 }