I am new to this from WebServices with php, and I have a problem, I hope this great community can help me.
I am consuming a method of a web service, but if it does not respond within 40 seconds I am asked to execute a query method to know the status of the request.
Searching I found that I can assign the response_timeout and assign it 40 seconds but when it was fulfilled, as it did not receive a response, it sent me an error and for a strange reason when I execute the query method, it marks me an error. How can I know or calculate 10 seconds, before the assigned time is reached in response_timeout?
This is my code ..
//Código para conexión
$client = new nusoap_client('https://testservice/Servicio?wsdl', 'wsdl' ,
false, false, false, false, 0, 40);
//Ingresamos usuario y contraseña paara el servicio web
$client->setCredentials($username,$password);
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
}
$proxy = $client->getProxy();
//Define parametros a enviar
$parametros = array('id_cadena'=>$id_cadena,
'id_tienda'=>$id_tienda,
'id_terminal'=>$id_terminal,
'folio'=>$folio,
'fechaLocal'=>$fechaLocal,
'referencia'=>$referencia,
'monto'=>$monto,
'sku'=>$sku);
$start = time();
$result = $proxy->venta($parametros);
//$result = $client->call("venta",$parametros);
$timing = time() - $start;
if($timing > 30 && $timing < 46){
echo utf8_decode('<script>alert("Metodo consulta venta Tiempo inicial '.$start.' tiempo final'.$timing.'")</script>');
$resultcon = $proxy->consultaVenta($parametros);
$respuestacon = array($resultcon);
$_SESSION['respuestaVen']=$respuestacon;
$codigo = $respuestacon[0]['return']['respuesta']['codigoRespuesta'];
echo utf8_decode('<script>alert("Valor de codigo '.$codigo.'")</script>');
}