Ver Mensaje Individual
  #3262  
Antiguo 18-08-2022
nincillo nincillo is offline
Miembro
 
Registrado: may 2017
Posts: 151
Reputación: 8
nincillo Va por buen camino
Cita:
Empezado por Francisco1973 Ver Mensaje
Hola, como envio:

defWSDL:='https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroFactEmitidas.wsdl';
defSvc:='siiService';
defPrt:='SuministroFactEmitidasPruebas';

HTTPRIO1.WSDLLocation:=defWSDL;
HTTPRIO1.Service:=defSvc;
HTTPRIO1.Port:=defPrt;

CrearSumLRFacturasEmitidasTest(Peticion);
Resultado:=GetsiiSOAP(true,'',HTTPRIO1).SuministroLRFacturasEmitidas(Peticion);

Y el certificado: (es necesario tener registrado capicom.dll y la unidad CAPICOM_TLB

procedure TForm1.HTTPRIO1HTTPWebNode1BeforePost(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:=NombreCertificado; { subject del certificado instalado: Nombre de la empresa }

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 ); { Buscar certificado por nombre }
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( 'Internet SSL certificate. Something went wrong' );
end;
end;
end;
Siento revivir este post tan antiguo, pero estoy intentando utilizarlo el D2007 y no consigo compilarlo porque me da error en:
Código:
var
PCertContext : PCCERT_CONTEXT;
No reconoce PCCERT_CONTEXT.

Y en:
Código:
if InternetSetOption(Data,INTERNET_OPTION_CLIENT_CERT_CONTEXT,PCertContext,Sizeof(CERT_CONTEXT)) = False then
      begin
        ShowMessage( 'Internet SSL certificate. Something went wrong' );
      end;
    end;
No reconoce CERT_CONTEXT.

¿Me faltará poner algún USES o algo?

Gracias y un saludo.
Responder Con Cita