configureWSDL('loginwsdl', 'urn:loginwsdl'); // Put the WSDL schema types in the namespace with the tns prefix $server->wsdl->schemaTargetNamespace = 'urn:loginwsdl'; // Register the data structures used by the service $server->wsdl->addComplexType( 'Login', 'complexType', 'struct', 'all', '', array( 'usuario' => array('name' => 'usuario', 'type' => 'xsd:string'), 'clave' => array('name' => 'clave', 'type' => 'xsd:string') ) ); $server->wsdl->addComplexType( 'Perfil', 'complexType', 'struct', 'all', '', array( 'cod_error' => array('name' => 'cod_error', 'type' => 'xsd:int'), 'des_error' => array('name' => 'des_error', 'type' => 'xsd:string'), 'id_perfil' => array('name' => 'id_perfil', 'type' => 'xsd:int'), 'perfil' => array('name' => 'perfil', 'type' => 'xsd:string') ) ); // Register the method to expose $server->register( 'loginUser', // method name array('login' => 'tns:Login'), // input parameters array('return' => 'tns:Perfil'), // output parameters 'urn:loginwsdl', // namespace 'urn:loginwsdl/hello', // soapaction 'rpc', // style 'encoded', // use 'Funcion para validar si existe el usuario y password de la base de datos' // documentation ); function loginUser($login) { global $conectar; $db = pg_connect($conectar); $sql = "select cod_error, des_error, id_perfil, perfil from ase.ase_login ('".$login['usuario']."', '".$login['clave']."')"; $rs = pg_exec($db,$sql); $row = pg_fetch_array ($rs, $i); $cod_error = $row['cod_error']; $des_error = $row['des_error']; $id_perfil = $row['id_perfil']; $perfil = $row['perfil']; pg_close($db); return array( 'cod_error' => $cod_error, 'des_error' => $des_error, 'id_perfil' => $id_perfil, 'perfil' => $perfil ); } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?>