![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
|
|
#1
|
||||
|
||||
|
Francisco1973 lo primero gracias. Justo lo que necesitamos es la forma de enviar no la de construir el xml.
|
|
#2
|
|||
|
|||
|
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; |
|
#3
|
||||
|
||||
|
gracias Francisco1973
ese código funciona perfecto. saludos ! |
|
#4
|
||||
|
||||
|
Podeis subir un ejemplo completo en un proyecto delphi.
Gracias. |
|
#5
|
||||
|
||||
|
keys ...
simplemente añade este evento en tu objeto(S) thttprio, y en V:= coloca el nombre de tu certificado. descarga y mira el adjunto que coloco y listo. No tienes si quiera que quitar el código anterior para gestionar el certificado. Saludos ! y por fa, siento ser pesado si alguien tiene algún ejemplo de facturas recibidas y emitidas de sujeto pasivo que lo postee. (lo que yo llamo la factura recibida, y su autofactura). Código:
procedure TfEmitidas.emitidasHTTPWebNode1BeforePost(
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:=' *** EL NOMBRE DE TU 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 ); { 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;
|
|
#6
|
||||
|
||||
|
Puedes indicarme los includes para
Store : IStore; Certs : ICertificates; Cert : ICertificate2; CertContext : ICertContext; Estoy un poco espeso y no los encuentro. |
|
#7
|
||||
|
||||
|
estan en el CAPICOM_TLB.pas (que he colocado en la descarga del post)
![]() |
|
#8
|
|||
|
|||
|
Cita:
A parte de poder buscar el certificado en el store como en el ejemplo anterior, que funciona perfectamente (muchas gracias por el post!) también he visto que hay la opción de poder leer el certificado desde un fichero:
P.D. Muchas gracias a todos los que colaboráis en este forum, que me habéis ayudado muchísimo en afrontar este tema. ![]() |
|
#9
|
|||
|
|||
|
Buenas tardes. Al fin he logrado establecer comunicación con el WS, pero me da un error muy simple (campo obligatorio NIF no informado).
¿ Se rellena en algún otro sitio el NIF que no me lo esté cogiendo a parte de estos 2 ? _RegistroLRFacturasEmitidas(i).IDFactura.IDEmisorFactura.NIF = "B17654XXX" _RegistroLRFacturasEmitidas(i).FacturaExpedida.Contraparte.NIFRepresentante = "A17135XXX" Gracias. |
|
#10
|
|||
|
|||
|
Cita:
Código:
var PCertContext : 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;
¿Me faltará poner algún USES o algo? Gracias y un saludo. |
|
#11
|
|||
|
|||
|
Yo lo uso en D2007, y tengo en el uses la unidad wcrypt2.pas, que puedes encontrar aquí:
https://github.com/delphiunderground/eid-mw-sdk-delphi |
|
#12
|
|||
|
|||
|
Cita:
Código:
Certs:=Store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME,V,False ); { Buscar certificado por nombre }
|
|
#13
|
|||
|
|||
|
Te he creado un gist en GitHub con el CAPICOM_TLB.pas que me generó a mí al importar la DLL; ahí sí tiene el Find
Espero que te sirva https://gist.github.com/JavierusTk/0...1096eb746b07cf |
|
#14
|
|||
|
|||
|
Cita:
El verificar los nif de los clientes ya lo puede hacer todo desde D2007. Ahora, si no lo he entendido mal, para poder enviar las facturas a FacturaE y en el futuro a Verifactu, solo me falta conseguir firmar las cabeceras de las peticiones SOAP antes de lanzar la petición. ¿Estoy en lo correcto?. ¿Alguien puede confirmarme que sea posible hacerlo desde D2007? |
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| TICKET BAI (TicketBAI); Nuevo sistema de la Agencia Tributaria del Pais Vasco | keys | Internet | 4530 | Hace 4 Semanas 14:09:59 |
| AEAT envio de datos vía Webservice problemas con WSDL | CelsoO | Internet | 11 | 09-10-2019 20:03:41 |
| webService Soap de la Administración Digital Española notific@ | apicito | Internet | 3 | 31-01-2017 11:25:28 |
| Error en Webservice funcion envio de sms | webmasterplc | Delphi para la web | 5 | 25-07-2013 20:10:29 |
| Problemas con envío de XML a un WebService | davidvamo | Internet | 1 | 13-02-2007 15:49:20 |
|