claves.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. require_once("../include/nusoap/nusoap.php");
  3. define("SECURITY", 'P4$$w0rd.S3gura#CiDit&2020');//token de seguridad
  4. $token = SECURITY;
  5. $clavesArr = array(2240, 16412, 5098, '03557', 'ad012999');
  6. $client = new nusoap_client('http://200.13.89.27/webservice/valida_cidit.php?wsdl', 'wsdl');//dirección del webservice
  7. if ($client->getError()) {
  8. $errorMsg = 'Error al conectarse al webservice';
  9. }else{
  10. $result = $client->call("busca_user", array($token, $clavesArr));//función en el webservice. Claves con texto se convierten a entero en la función y llega 0
  11. /*
  12. * result es un arreglo con los campos:
  13. * 'error' => 'xsd:boolean',
  14. * 'resultMessage'=>'xsd:string',
  15. * 'usuarios_array' => 'tns:UsuariosList'
  16. * 'usuario_nombre' => 'xsd:string',
  17. 'usuario_apellidos' => 'xsd:string',
  18. 'usuario_clave' => 'xsd:string',
  19. 'usuario_id' => 'xsd:integer',
  20. 'usuario_esProfesor' => 'xsd:boolean'),
  21. 'usuario_esAdministrativo' => 'xsd:boolean'
  22. */
  23. }
  24. ?>
  25. <html>
  26. <body style="padding:1em 2em">
  27. <h3>Claves buscadas</h3>
  28. <?php print_r($clavesArr);?>
  29. <p>Claves con letras se mandan como 0</p>
  30. <?php if(isset($errorMsg)){ ?>
  31. <p style="color:red;">ERROR de conexión! <?php echo $errorMsg;?> </p>
  32. <?php }
  33. if(isset($result)){ ?>
  34. <h4>Resultado</h4>
  35. <?php
  36. if($result["error"])
  37. echo '<p style="color:red;">Error! '.$result["resultMessage"].'</p>';
  38. else{
  39. foreach($result["usuarios_array"] as $usr){
  40. print_r($usr);
  41. echo '<br>';
  42. }
  43. }
  44. } ?>
  45. </body>
  46. </html>