Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   Validar DNI/CIF (https://www.clubdelphi.com/foros/showthread.php?t=95967)

keys 13-03-2024 11:23:17

Cita:

Empezado por iMia (Mensaje 554906)
El Wsdl ...

https:// ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl

Yo con el wsdl no conseguí hacerlo. Hice la llamada directamente al servicio con JSON.

iMia 13-03-2024 12:05:58

Cita:

Empezado por iMia (Mensaje 554906)
El Wsdl ...

https:// ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl

Perdón, puse el wsdl de test.
Este es el bueno;


https:// ec.europa.eu/taxation_customs/vies/checkVatService.wsdl

iMia 13-03-2024 12:06:50

Cita:

Empezado por keys (Mensaje 554907)
Yo con el wsdl no conseguí hacerlo. Hice la llamada directamente al servicio con JSON.

Pues me ha gustado mucho com lo has hecho directamente sin tener que importar el wsdl !!!

iMia 13-03-2024 16:08:40

enga va....

- importado el wsdl (ojo con los textos de más de 250 caracteres....)
- Ojoj que el pais lo he puesto con calzador... hay que parametrizarlo.

Código Delphi [-]

procedure TMainForm.btnValidarEUCIFClick(Sender: TObject);
var
  cv: checkVat;
  cvResp: checkVatResponse;
  cvWS: checkVatPortType;
  strMessage: string;

begin
  cv := checkVat.create();
  cv.countryCode := 'ES';
  cv.vatNumber := edDNI.Text;

  try
    cvWS := GetcheckVatPortType(false, '', nil);
    if cvWS <> nil then
    begin
      cvResp := cvWS.checkVat(cv);
      if cvResp.valid then
      begin
        strMessage := 'Valido!' + CRLF;
        strMessage := strMessage + 'CIF: ' + cvResp.vatNumber + CRLF;
      end
      else
        strMessage := 'NO ES VÁLIDO!';
      ShowMessage(strMessage);
    end;
  except
      on E: ERemotableException do
      begin
        ShowMessage('Sin respuesta: ' + #10 + #13 + E.message);
      end;
  end;
end;


La franja horaria es GMT +2. Ahora son las 12:34:16.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi