Exemple #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;
 }
 /**
  * @param Nexway\Data\Request $data
  *
  * @return string
  */
 private function sendRequest(Nexway\Data\Request $data)
 {
     $_wsdlHttpBinding = "";
     $_wsdlServiceName = "";
     if ($data->request instanceof Nexway\Data\Request\CatalogApi) {
         $_wsdlServiceName = "CatalogApi";
     } elseif ($data->request instanceof Nexway\Data\Request\OrderApi) {
         $_wsdlServiceName = "OrderApi";
     } elseif ($data->request instanceof Nexway\Data\Request\CustomerApi) {
         $_wsdlServiceName = "CustomerApi";
     }
     if (isset($this->config['service']['nexway']['url'][lcfirst($_wsdlServiceName)])) {
         $_wsdlHttpBinding = $this->config['service']['nexway']['url'][lcfirst($_wsdlServiceName)];
     }
     $client = new \Zend\Soap\Client();
     $client->setWSDL($_wsdlHttpBinding);
     $client->setOptions(array('soap_version' => SOAP_1_1));
     preg_match('/(?P<methodName>[^\\\\]+)$/i', get_class($data->request), $_matches);
     $methodName = $_matches['methodName'];
     return $client->{$methodName}($data);
 }
Exemple #3
-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);
 }