Ver Mensaje Individual
  #1369  
Antiguo 31-05-2017
Avatar de keys
keys keys is offline
Miembro
 
Registrado: sep 2003
Ubicación: Bilbao
Posts: 1.027
Reputación: 22
keys Va por buen camino
Cita:
Empezado por joefrommalaka Ver Mensaje
Por cierto si envío el archivo xml mediante la web https://www7.aeat.es/static_files/co...teWSAEAT2.html se envía correctamente.
Hola. Este problema ya esta resuelto en enlaces anteriores, es la forma de asignar el certificado. Se soluciono con las capicom. Yo he llegado a enviar un bloque de 10000 facturas para ver si funcionaba y todo correcto.

Te pongo el codigo pero revisa los post anteriores. En el evento OnbeforePost del objeto HttpTrio tienes que poner lo siguiente

Código Delphi [-]
  procedure TFSIIConsultar.SoapeadorHTTPWebNode1BeforePost(
  const HTTPReqResp: THTTPReqResp; Data: Pointer);
var
     Store : IStore;
     Certs : ICertificates;
     Cert : ICertificate2;
     CertContext : ICertContext;
     PCertContext : PCCERT_CONTEXT;
     V : OleVariant;
  
 const
     INTERNET_OPTION_CLIENT_CERT_CONTEXT = 84;
 begin

     V := Certificado;

     Store := CoStore.Create;
     Store.Open(CAPICOM_CURRENT_USER_STORE, 'MY',CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED );
     Certs := Store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME,V,False );

     if Certs.Count > 0 then
     begin

         Cert:=IInterface(Certs.Item[1]) as ICertificate2;

         CertContext:=Cert as ICertContext;
         CertContext.Get_CertContext(Integer(PCertContext));


        

         if InternetSetOption(Data,INTERNET_OPTION_CLIENT_CERT_CONTEXT,PCertContext,Sizeof(CERT_CONTEXT)) = False then
          begin
             showmessage('ERROR');
          end;
     end
     else
      begin
        showmessage('ERROR');
      end;
 end;
Responder Con Cita