public function init() { try { $init = new \XmlProcess(); $init->readFile(); $xml = $init->convertXmlToObject(); $xml->DatosPoliza->InformacionPoliza->primerNombreTomador = self::validatePostField('primerNombreTomador'); $xml->DatosPoliza->InformacionPoliza->direccionTomador = self::validatePostField('direccionTomador'); $xml->DatosPoliza->InformacionPoliza->ciudadTomador = self::validatePostField('ciudadTomador'); $xml->DatosPoliza->InformacionPoliza->numeroPoliza = self::validatePostField('numeroPoliza'); $xml->DatosPoliza->InformacionPoliza->numeroCertificado = self::validatePostField('numeroCertificado'); $xml->DatosPoliza->InformacionPoliza->numeroFactura = self::validatePostField('numeroFactura'); $xml->DatosPoliza->DatosRiesgo->numeroRiesgo = self::validatePostField('numeroRiesgo'); $xml->DatosPoliza->InformacionPoliza->fechaExpedicion = self::validatePostField('fechaExpedicion'); $xml->DatosPoliza->InformacionPoliza->tipoModificacion = self::validatePostField('tipoModificacion'); $_SESSION['XML'] = base64_encode($init->__toString()); if ($_SESSION['XML'] != '') { $ws = new \WebService(); $ws->setDriver($_SESSION['XML']); $ws->callWS(); $result = $ws->getResult(); if (isset($result)) { $_SESSION['RESULT'] = $result; } $_SESSION['ERROR'] = $ws->getError(); if (is_array($_SESSION['RESULT']) && count($_SESSION['RESULT'])) { if (isset($result['return'])) { $_SESSION['BASE64'] = $result['return']; $_SESSION['ERROR'] = ''; } else { $_SESSION['BASE64'] = ''; $_SESSION['ERROR'] = $_SESSION['ERROR'] . ' | No se encuentra variable "RetornoBase64"'; } } } } catch (Exception $e) { Logger::error($e); } }
/** * Stores a web service in the database. * * @param WebService $webService * * @return bool * <true>, if successful * <false>, otherwise * */ public function storeWS(WebService &$webService) { $db =& wfGetDB(DB_MASTER); try { $db->replace($db->tableName('smw_ws_wwsd'), null, array('web_service_id' => $webService->getArticleID(), 'uri' => $webService->getURI(), 'protocol' => $webService->getProtocol(), 'method' => $webService->getMethod(), 'parameters' => $webService->getParameters(), 'result' => $webService->getResult(), 'display_policy' => $webService->getDisplayPolicy(), 'query_policy' => $webService->getQueryPolicy(), 'update_delay' => $webService->getUpdateDelay(), 'span_of_life' => $webService->getSpanOfLife(), 'expires_after_update' => $webService->doesExpireAfterUpdate() == "true" ? 'true' : 'false', 'confirmed' => $webService->getConfirmationStatus(), 'authentication_type' => $webService->getAuthenticationType(), 'authentication_login' => $webService->getAuthenticationLogin(), 'authentication_password' => $webService->getAuthenticationPassword())); } catch (Exception $e) { $temp = $e->getMessage(); $this->{$temp}(); echo $e->getMessage(); return false; } return true; }
/** * this method checks if a wwsd was deleted or modified * and therefore has to be removed from the database * * @param WebService $mNewWebService * @return boolean */ public static function detectModifiedWWSD($mNewWebService) { if (self::$mOldWebservice) { if (!$mNewWebService) { return true; } $remove = false; if (self::$mOldWebservice->getArticleID() != $mNewWebService->getArticleID()) { $remove = true; } else { if (self::$mOldWebservice->getMethod() != $mNewWebService->getMethod()) { $remove = true; } else { if (self::$mOldWebservice->getParameters() != $mNewWebService->getParameters()) { $remove = true; } else { if (self::$mOldWebservice->getProtocol() != $mNewWebService->getProtocol()) { $remove = true; } else { if (self::$mOldWebservice->getResult() != $mNewWebService->getResult()) { $remove = true; } else { if (self::$mOldWebservice->getURI() != $mNewWebService->getURI()) { $remove = true; } } } } } } return $remove; } return false; }