Ver Mensaje Individual
  #1699  
Antiguo 30-09-2021
iMia iMia is offline
Miembro
 
Registrado: jul 2010
Posts: 141
Reputación: 14
iMia Va por buen camino
Cita:
Empezado por ermendalenda Ver Mensaje
Chequeo de cif múltiples países:
Hola me han pasado el webservice los wsdl para chequear cifs.
Alguien interesado en echarle un ojo y generar algún ejemplo: xml y parámetros curl?
Según me dicen, no solo mira si es válido si no que esté activo
Código Delphi [-]
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : https://www2.agenciatributaria.gob.e...ws/VNifV2.wsdl
//  >Import : https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2.wsdl>0
//  >Import : https://www2.agenciatributaria.gob.e.../VNifV2Ent.xsd
//  >Import : https://www2.agenciatributaria.gob.e.../VNifV2Sal.xsd
// Encoding : UTF-8
// Version  : 1.0
// (09/07/2021 15:44:34 - - $Rev: 90173 $)
// ************************************************************************ //

unit VNifV21;

interface

uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;

const
  IS_UNBD = $0002;


type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]

  Contribuyente        = class;                 { "http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Ent.xsd"[Cplx] }
  Contribuyente2       = class;                 { "http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Sal.xsd"[Cplx] }

  VNifV2Sal2 = array of Contribuyente2;         { "http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Sal.xsd"[Lit][GblCplx] }
  VNifV2Sal       =  type VNifV2Sal2;      { "http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Sal.xsd"[Lit][GblElm] }
  VNifV2Ent2 = array of Contribuyente;          { "http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Ent.xsd"[Lit][GblCplx] }
  VNifV2Ent       =  type VNifV2Ent2;      { "http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Ent.xsd"[Lit][GblElm] }


  // ************************************************************************ //
  // XML       : Contribuyente, 
  // Namespace : http://www2.agenciatributaria.gob.es.../VNifV2Ent.xsd
  // ************************************************************************ //
  Contribuyente = class(TRemotable)
  private
    FNif: string;
    FNombre: string;
  published
    property Nif:    string  read FNif write FNif;
    property Nombre: string  read FNombre write FNombre;
  end;



  // ************************************************************************ //
  // XML       : Contribuyente, 
  // Namespace : http://www2.agenciatributaria.gob.es.../VNifV2Sal.xsd
  // ************************************************************************ //
  Contribuyente2 = class(TRemotable)
  private
    FNif: string;
    FNombre: string;
    FResultado: string;
  published
    property Nif:       string  read FNif write FNif;
    property Nombre:    string  read FNombre write FNombre;
    property Resultado: string  read FResultado write FResultado;
  end;


  // ************************************************************************ //
  // Namespace : http://www2.agenciatributaria.gob.es...ws/VNifV2.wsdl
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : VNifV2SoapBinding
  // service   : VNifV2Service
  // port      : VNifPort1
  // URL       : https://www1.agenciatributaria.gob.e.../ws/VNifV2SOAP
  // ************************************************************************ //
  VNifV2 = interface(IInvokable)
  ['{0FA68156-DD7D-DED4-F168-3936F989AAA0}']

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    function  VNifV2(const VNifV2Ent: VNifV2Ent): VNifV2Sal; stdcall;
  end;

function GetVNifV2(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): VNifV2;


implementation
  uses System.SysUtils;

function GetVNifV2(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): VNifV2;
const
  defWSDL = 'https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2.wsdl';
  defURL  = 'https://www1.agenciatributaria.gob.es/wlpl/BURT-JDIT/ws/VNifV2SOAP';
  defSvc  = 'VNifV2Service';
  defPrt  = 'VNifPort1';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as VNifV2);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  { VNifV2 }
  InvRegistry.RegisterInterface(TypeInfo(VNifV2), 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2.wsdl', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(VNifV2), '');
  InvRegistry.RegisterInvokeOptions(TypeInfo(VNifV2), ioDocument);
  InvRegistry.RegisterInvokeOptions(TypeInfo(VNifV2), ioLiteral);
  RemClassRegistry.RegisterXSInfo(TypeInfo(VNifV2Sal2), 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Sal.xsd', 'VNifV2Sal2', 'VNifV2Sal');
  RemClassRegistry.RegisterSerializeOptions(TypeInfo(VNifV2Sal2), [xoLiteralParam]);
  RemClassRegistry.RegisterXSInfo(TypeInfo(VNifV2Sal), 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Sal.xsd', 'VNifV2Sal');
  RemClassRegistry.RegisterXSInfo(TypeInfo(VNifV2Ent2), 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Ent.xsd', 'VNifV2Ent2', 'VNifV2Ent');
  RemClassRegistry.RegisterSerializeOptions(TypeInfo(VNifV2Ent2), [xoLiteralParam]);
  RemClassRegistry.RegisterXSInfo(TypeInfo(VNifV2Ent), 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Ent.xsd', 'VNifV2Ent');
  RemClassRegistry.RegisterXSClass(Contribuyente, 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Ent.xsd', 'Contribuyente');
  RemClassRegistry.RegisterXSClass(Contribuyente2, 'http://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/burt/jdit/ws/VNifV2Sal.xsd', 'Contribuyente2', 'Contribuyente');

end.

envias nif/cif y nombre en VNifV2Ent y te dice si es correcto o no en VNifV2Sal
Ojo que el nombre debe ser muy aproximado, no hace falta que sea exactamente igual...
debes meter un certificado vàlido en el THTTPRIO con el HTTPRIO.HTTPWebNode.OnBeforePost := HTTPWebNode1BeforePost;

puedes enviar una lista para comprobar con VNifV2Ent2

Última edición por iMia fecha: 30-09-2021 a las 17:32:20.
Responder Con Cita