<?php        

include("config.php");
include("core/model/sqlsrv.php");

include("core/library/general_util.php");

require_once('class/Auditoria.php');

include("function_library/global_functions/general_functions.php");
include("function_library/global_functions/validate.php");

class MyException extends Exception {

    public $file;
    public $line;

    public static function errorHandler($errno, $errstr, $errfile, $errline) {
        $e = new self();
        $e->message = $errstr;
        $e->code = $errno;
        $e->file = $errfile;
        $e->line = $errline;

        $f = fopen('PHP_ERR_' . date("Y-m-d") . '.log', 'a+');
        fwrite($f, $_SESSION['VERSION'] . "" . date('Y-m-d h:m:s') . " \n\n " . print_r($e, true) . " \r\n");
        fclose($f);

        throw $e;
    }

}


$class = @$_GET['url'];


if ($class=='clientes'){

	set_error_handler(array('MyException', 'errorHandler'), E_ALL);
	
    include("function_library/client_functions/clientes.php");
    $server = new SoapServer(
            null, // No utilizar WSDL
            array('uri' => URI_SOAP) // Se debe especificar el URI
    );
    $server->addFunction( $_config['functions']['clientes']);
    $server->handle();
}
/*
if ($class=='users'){
    include("function_library/client_functions/usuarios.php");
    $server_user = new SoapServer(
            null, // No utilizar WSDL
            array('uri' => 'localhost/pasarela/users:users') // Se debe especificar el URI
    );
    $server_user->addFunction( $_config['functions']['users']);
    $server_user->handle();
}

if ($class=='users_cards'){
    include("function_library/client_functions/usuarios.php");
    $server_user = new SoapServer(
            null, // No utilizar WSDL
            array('uri' => 'localhost/pasarela/users:users_cards') // Se debe especificar el URI
    );
    $server_user->addFunction( $_config['functions']['users']);
    $server_user->handle();
}
*/












?>