/** * Fetches the statuses of the circuit boards from the database. * @throws Exception If a query fails to execute. */ public function fetchUpdates() { $soap = new SoapClientWrapper(); $messages = $soap->getNewMessages(); $database = new DatabaseWrapper(); $database->connect(DB_NAME); foreach ($messages as $message) { $xmlParser = new XMLParser($message); $xmlParser->parse(); $parsedMessage = $xmlParser->getParsedData(); $validator = new SMSValidator($parsedMessage); try { $msisdn = $validator->validateMSISDN(); $status = $validator->validateStatus(); $information = $database->queryBoardInformation($msisdn); $update = new CircuitBoard($information, $status); $database->updateBoardStatus($msisdn, $status); $this->model->addUpdate($update); } catch (Exception $e) { continue; } } }
/** * Enter description here... * * @param string $wsdl * @param bool $forceNuSoap * @return SoapClient */ public static function GetService($wsdl, $forceNuSoap = false) { if (extension_loaded("soap") && !$forceNuSoap) { Debug::PrintValue("Local"); $client = new SoapClient($wsdl); return $client; } else { Debug::PrintValue("NuSoap"); if (!SoapClientWrapper::$_readed) { //Debug::PrintValue("Read NuSoap"); require_once "nusoap.php"; SoapClientWrapper::$_readed = true; } $client = new nusoap_client($wsdl, 'wsdl'); $proxy = $client->getProxy(); return $proxy; } }