Ver Mensaje Individual
  #7  
Antiguo 22-03-2025
Avatar de ramherfer
ramherfer ramherfer is offline
Miembro
 
Registrado: may 2013
Ubicación: Valencia
Posts: 162
Reputación: 14
ramherfer Va por buen camino
Voy de momento a usar esta función con la URL del Endpoint de la AEAT

Código Delphi [-]
function VerificarServicioSOAP(const URL: string; Intentos: Integer): Boolean;
var
  HTTP: TIdHTTP;
  SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
  I: Integer;
begin
  Result := False; 
  HTTP := TIdHTTP.Create(nil);
  SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  try
    HTTP.IOHandler := SSLHandler;
    HTTP.ReadTimeout := 5000; 

    for I := 1 to Intentos do
    begin
      try
        HTTP.Head(URL);
        Result := True; // El servicio está activo
        Exit;
      except
        on E: EIdException do
          ; // Oculta cualquier error de Indy
        on E: Exception do
          ; // Oculta otros errores generales
      end;
    end;
  finally
    SSLHandler.Free;
    HTTP.Free;
  end;
end;

Con un elemento visual en verde si está activo y en rojo si NO está activo en el statusBar.
Esto en el hilo principal de la aplicación y si al ir a remitir facturas a la señora AEAT si está inactivo que ni lo intente.
Ya que en estos momentos está caido lo tengo a modo de pruebas
__________________
Se humilde para admitir tus errores, inteligente para aprender de ellos y maduro para corregirlos.