Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Colaboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 20-09-2021
ermendalenda ermendalenda is offline
Miembro
 
Registrado: ago 2021
Posts: 2.761
Poder: 7
ermendalenda Va por buen camino
Cita:
Empezado por iMia Ver Mensaje
No, entre pruebas no he tocado nada de la dirección...
Solo se me ocurre eso o que ya no exista el fichero a enviar por que lo muevas o algo así.
Responder Con Cita
  #2  
Antiguo 20-09-2021
juramisa juramisa is offline
Miembro
 
Registrado: abr 2007
Posts: 54
Poder: 20
juramisa Va por buen camino
Buenas tardes,

A ver si alguien puede ayudarme. Estoy intentando enviar un fichero XML, creado igual que para Bizkaia, pero con las diferencias de Gipuzcoa lo guardado en 'el_fichero_a_enviar', sin comprimir.

Código:
  <?xml version="1.0" encoding="UTF-8" ?> 
- <T:TicketBai xmlns:T="urn:ticketbai:emision">
- <Cabecera>
  <IDVersionTBAI>1.2</IDVersionTBAI> 
....
</T:TicketBai>
A la hora de enviar, yo utilizo HTTPClient de SecureBlackBox, programación en Delphi

Código Delphi [-]
      sbxHTTPClient1.RequestParameters.ContentType := 'application/xml;charset=UTF-8';
      otros_parametros := 'Accept-Encoding: '             + '' + #13#10
                        + 'Content-Encoding: '            + '';
      sbxHTTPClient1.RequestParameters.CustomHeaders := otros_parametros;

      sbxHTTPClient1.PostFile('https://tbai-prep.egoitza.gipuzkoa.eus/WAS/HACI/HTBRecepcionFacturasWEB/rest/recepcionFacturas/alta', el_fichero_a_enviar);

El componente me dice que la cabecera va con la siguiente información

Código:
POST /WAS/HACI/HTBRecepcionFacturasWEB/rest/recepcionFacturas/alta HTTP/1.1: 
Content-Type: application/xml;charset=UTF-8
Host: tbai-prep.egoitza.gipuzkoa.eus
User-Agent: SecureBlackbox
Accept-Encoding: 
Connection: keep-alive
Content-Encoding: 
Content-Length: 9411
Pues bien, al enviar da un error 'Connection lost due to error 10058' aparentemente me rechaza y no consigo, por más pruebas y combinaciones que haga al conectar. Podéis indicarme como lo hacéis vosotros, para ver donde me equivoco?

Gracias
Responder Con Cita
  #3  
Antiguo 21-09-2021
Avatar de HerensugeBeltz
HerensugeBeltz HerensugeBeltz is offline
Miembro
 
Registrado: may 2021
Ubicación: Hondarribia
Posts: 90
Poder: 6
HerensugeBeltz Va por buen camino
TicketBAI: firma de un XML con SecureBlackBox 2020

Cita:
Empezado por juramisa Ver Mensaje
Buenas tardes,

A ver si alguien puede ayudarme. Estoy intentando enviar un fichero XML, creado igual que para Bizkaia, pero con las diferencias de Gipuzcoa lo guardado en 'el_fichero_a_enviar', sin comprimir.

A la hora de enviar, yo utilizo HTTPClient de SecureBlackBox, programación en Delphi

Pues bien, al enviar da un error 'Connection lost due to error 10058' aparentemente me rechaza y no consigo, por más pruebas y combinaciones que haga al conectar. Podéis indicarme como lo hacéis vosotros, para ver donde me equivoco?

Gracias
Hola Juramisa,
Te adjunto el código que uso yo. Los envíos de prueba van bien (es en C++Builder). En mi caso tuve problemas con el método SendFile y tuve que usar PostBytes. XMLOrigen es el fichero XML firmado y grabado en disco.

Código:
  // Cargo el fichero como un array de bytes. Con otros métodos se desvirtuaba el
  // contenido y el envío fallaba.
  DynamicArray<byte> cnt;
  std::unique_ptr<TFileStream> fs(new TFileStream(XMLOrigen,	fmOpenRead));
  cnt.Length= fs->Size;
  fs->Read(cnt, 0, cnt.Length);

  bool resul(true);
  try
  {
    sbxHTTPClient1->TLSAutoValidateCertificates= true; 
    sbxHTTPClient1->TLSVersions= TsbxConstants::csbTLS12;
    sbxHTTPClient1->ReqParamsContentType= L"application/xml;charset=UTF-8";
    sbxHTTPClient1->ReqParamsAcceptCharset= L"UTF-8";
    sbxHTTPClient1->ReqParamsAccept= L"*/*";
    sbxHTTPClient1->ReqParamsHTTPVersion= TsbxHTTPClientReqParamsHTTPVersions::chvHTTP11;
    sbxHTTPClient1->TLSRenegotiationAttackPreventionMode= TsbxHTTPClientTLSRenegotiationAttackPreventionModes::crapmAuto;
    sbxHTTPClient1->Config(L"UseSystemCertificates=true");
    // Cambio el timeout por defecto
  // SocketDNSTotalTimeout (0): The timeout (in milliseconds) for the whole resolution process
  // SocketTimeout (60000): The maximum period of waiting, in milliseconds, after which the socket operation is considered unsuccessful.
    sbxHTTPClient1->SocketDNSTotalTimeout= 2000;
    sbxHTTPClient1->SocketTimeout= 2500;

    sbxHTTPClient1->PostBytes(endPoint, cnt);
  }
  catch (Exception &e)
  {
    err= L"Error en el envío de la factura XML.\r\n"+ e.Message + L"\r\n" +
      sbxHTTPClient1->ReasonPhrase;
    resul= false;
  }
Responder Con Cita
  #4  
Antiguo 21-09-2021
Avatar de keys
keys keys is offline
Miembro
 
Registrado: sep 2003
Ubicación: Bilbao
Posts: 1.229
Poder: 24
keys Va por buen camino
Hola a todos.

Creo que se aproximan cambios en los formatos de los ficheros xml. Si os fijais en la actualización de las validaciones que acaba se sacar Gipuzkoa, en la página 15 habla de una clave 17.

Cita:
VALIDACIONES PARA OPERACIONES DE LA CLAVE DE RÉGIMEN 17 · OSS/IOSS

Si la ClaveRegimenIVAOpTranscendencia igual a ·17·, para el bloque Sujeta NoExenta solo se permite el tipo de no exenta ·S1·

Todo para el tema de las operaciones OSS, que se ha añadido recientemente al SII. Por supuesto la clave 17 no existe en la descripción del XML de TicketBAI.

Un Saludo.
Responder Con Cita
  #5  
Antiguo 21-09-2021
chuski1212 chuski1212 is offline
Registrado
 
Registrado: sep 2021
Posts: 8
Poder: 0
chuski1212 Va por buen camino
Hola buenas a todos,

Estoy trabajando en el sistema de pruebas de Guipuzkoa y para cada envio obtengo el error 010 Posible error de encadenamiento.

Se supone que si una factura tiene los datos requeridos de la anterior, esta bien encadenada no? Aunque la anterior no estuviese encadenada correctamente.

Al empezar las pruebas hace semanas no estaba enviando el encadenamiento, puede ser este el problema? De ser asi, ahora no se cual es la primera desde la que tengo que seguir la cadena.

Alguien tiene alguna idea al respecto?

Muchisimas gracias!!
Responder Con Cita
  #6  
Antiguo 21-09-2021
elguille elguille is offline
Miembro
 
Registrado: ene 2005
Posts: 130
Poder: 22
elguille Va por buen camino
Cita:
Empezado por chuski1212 Ver Mensaje
Hola buenas a todos,

Estoy trabajando en el sistema de pruebas de Guipuzkoa y para cada envio obtengo el error 010 Posible error de encadenamiento.

Se supone que si una factura tiene los datos requeridos de la anterior, esta bien encadenada no? Aunque la anterior no estuviese encadenada correctamente.

Al empezar las pruebas hace semanas no estaba enviando el encadenamiento, puede ser este el problema? De ser asi, ahora no se cual es la primera desde la que tengo que seguir la cadena.

Alguien tiene alguna idea al respecto?

Muchisimas gracias!!
Mientras estuve haciendo pruebas recibia este error pero a la primera que rellene los datos de la factura anterior correctamente deje de recibirlos, fijate que envias solo los primeros 100 caracteres de SignatureValue.
Código PHP:
        <EncadenamientoFacturaAnterior>
            <
SerieFacturaAnterior>A2022</SerieFacturaAnterior>
            <
NumFacturaAnterior>0416</NumFacturaAnterior>
            <
FechaExpedicionFacturaAnterior>13-09-2021</FechaExpedicionFacturaAnterior>
            <
SignatureValueFirmaFacturaAnterior>bC6lFn1GmPEVsqriytT+2gN6/WMq48nYRceoCRlptLqTQZjAmIO7AHqSofqKvnLWmAM1KHrrc2bVtHvYHHrosTTrEciXIl2ZI6P9</SignatureValueFirmaFacturaAnterior>
        </
EncadenamientoFacturaAnterior
Responder Con Cita
  #7  
Antiguo 21-09-2021
ermendalenda ermendalenda is offline
Miembro
 
Registrado: ago 2021
Posts: 2.761
Poder: 7
ermendalenda Va por buen camino
Cita:
Empezado por chuski1212 Ver Mensaje
Hola buenas a todos,

Estoy trabajando en el sistema de pruebas de Guipuzkoa y para cada envio obtengo el error 010 Posible error de encadenamiento.

Se supone que si una factura tiene los datos requeridos de la anterior, esta bien encadenada no? Aunque la anterior no estuviese encadenada correctamente.

Al empezar las pruebas hace semanas no estaba enviando el encadenamiento, puede ser este el problema? De ser asi, ahora no se cual es la primera desde la que tengo que seguir la cadena.

Alguien tiene alguna idea al respecto?

Muchisimas gracias!!
A mi me pasó, en mi caso era que aunque el encadenamiento (de la firma) estaba bien tenia la serie escrita un pelín diferente un guión en vez de un punto respecto a la enviada anterior.
Comprueba también Serie anterior y número anterior y si no está exacto da el mismo error que si mandas mal la firma anterior..
Responder Con Cita
  #8  
Antiguo 21-09-2021
juramisa juramisa is offline
Miembro
 
Registrado: abr 2007
Posts: 54
Poder: 20
juramisa Va por buen camino
Entorno de pruebas Gipuzkoa

Cita:
Empezado por HerensugeBeltz Ver Mensaje
Hola Juramisa,
Te adjunto el código que uso yo. Los envíos de prueba van bien (es en C++Builder). En mi caso tuve problemas con el método SendFile y tuve que usar PostBytes. XMLOrigen es el fichero XML firmado y grabado en disco.

Código:
..  {
    sbxHTTPClient1->TLSAutoValidateCertificates= true; 
    sbxHTTPClient1->TLSVersions= TsbxConstants::csbTLS12;
    sbxHTTPClient1->ReqParamsContentType= L"application/xml;charset=UTF-8";
    sbxHTTPClient1->ReqParamsAcceptCharset= L"UTF-8";
    sbxHTTPClient1->ReqParamsAccept= L"*/*";
    sbxHTTPClient1->ReqParamsHTTPVersion= TsbxHTTPClientReqParamsHTTPVersions::chvHTTP11;
    sbxHTTPClient1->TLSRenegotiationAttackPreventionMode= TsbxHTTPClientTLSRenegotiationAttackPreventionModes::crapmAuto;
    sbxHTTPClient1->Config(L"UseSystemCertificates=true");
    // Cambio el timeout por defecto
  // SocketDNSTotalTimeout (0): The timeout (in milliseconds) for the whole resolution process
  // SocketTimeout (60000): The maximum period of waiting, in milliseconds, after which the socket operation is considered unsuccessful.
    sbxHTTPClient1->SocketDNSTotalTimeout= 2000;
    sbxHTTPClient1->SocketTimeout= 2500;
..
  }
Muchisimas gracias, ha funcionado a la primera.

Me has salvado.

Os dejo como quedan los envío con SecureBlackBox desde Delphi


Código Delphi [-]
  procedure GuardarRespuesta(const Fichero: string; Respuesta: TBytes);
  var
    stream: TBytesStream;
  begin
    stream := TBytesStream.Create(Respuesta);
    try
      stream.SaveToFile(Fichero);
    finally
      stream.Free;
    end;
  end;
  function bintostr(const bin: array of byte): string;
  const
    HexSymbols = '0123456789ABCDEF';
  var
    i: integer;
  begin
    SetLength(Result, 2 * Length(bin));
    for i := 0 to Length(bin) - 1 do
    begin
      Result[1 + 2 * i + 0] := HexSymbols[1 + bin[i] shr 4];
      Result[1 + 2 * i + 1] := HexSymbols[1 + bin[i] and $0F];
    end;
  end;

procedure p_envio_TicketBai
var 
  la_respuesta : IXMLTicketBaiResponse;

begin
  try
  el_fichero_a_enviar := 'ruta y nombre fichero ticketbai';


if FileExists(el_fichero_a_enviar) then
  WebBrowser1.Navigate(el_fichero_a_enviar);
if FileExists(el_fichero_a_enviar) then
begin

  sbxHTTPClient1.TLSSettings.AutoValidateCertificates := True;
  CertificateStorage := TsbxCertificateStorage.Create(nil);
  if CertificateStorage.Opened then
    CertificateStorage.Close(True);
  CertificateStorage.Open('system://currentuser@localhost/?store=MY');
  encontrado := False;
  sbxHTTPClient1.ClientChain.Clear;
  for i := 0 to CertificateStorage.Certificates.Count - 1 do
  begin
    cert := CertificateStorage.Certificates[i];
    if bintostr(cert.SerialNumber) = mi_certificadoID.Caption then
    begin
      sbxHTTPClient1.ClientChain.Add(cert);
      encontrado := True;
    end;
  end;
  if not encontrado then
  begin
    Application.MessageBox('Firma no encontrada', 'Proceso de firma', MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);
    Exit;
  end;

  sbxHTTPClient1.RequestParameters.ContentType := 'application/xml;charset=UTF-8';
  sbxHTTPClient1.RequestParameters.AcceptCharset := 'UTF-8';
  sbxHTTPClient1.RequestParameters.Accept := '*/*';
  sbxHTTPClient1.RequestParameters.HTTPVersion := TsbxHTTPClientReqParamsHTTPVersions.chvHTTP11;
  sbxHTTPClient1.TLSSettings.RenegotiationAttackPreventionMode := TsbxHTTPClientTLSRenegotiationAttackPreventionModes.crapmAuto;
  sbxHTTPClient1.Config('UseSystemCertificates=true');
  sbxHTTPClient1.SocketSettings.DNSTotalTimeout := 2000;
  sbxHTTPClient1.SocketSettings.Timeout := 2500;
  otros_parametros := 'Accept-Encoding: ' + #13#10
                    + 'Content-Encoding: ' ;
  sbxHTTPClient1.RequestParameters.CustomHeaders := otros_parametros;

  case rg_Entorno.ItemIndex of
    0: sbxHTTPClient1.PostFile(la_url_GI_alta_pruebas, el_fichero_a_enviar);
    1: sbxHTTPClient1.PostFile(la_url_GI_alta, el_fichero_a_enviar);
  end;
  if sbxHTTPClient1.OutputBytes = nil then
    Exit;
  FicheroRespuesta := el_fichero_a_recibir;
  GuardarRespuesta(FicheroRespuesta,sbxHTTPClient1.OutputBytes);

  if FileExists(el_fichero_a_recibir) then
    wbRecepcion.Navigate(el_fichero_a_recibir);
  // Cabecera
  {$REGION Cabecera}
  XMLDocument1 := TXMLDocument.Create(nil);

  XMLDocument1.Active := False;
  XMLDocument1.XML.Clear;
  XMLDocument1.LoadFromFile(el_fichero_a_recibir);

  XMLDocument1.Active := True;

  XMLDocument1.XML.Text := StringReplace(XMLDocument1.XML.Text, 'ns2:TicketBai', 'TicketBai', [rfReplaceAll, rfIgnoreCase]);
  XMLDocument1.XML.Text := StringReplace(XMLDocument1.XML.Text, 'xmlns:ns2', 'xmlns', [rfReplaceAll, rfIgnoreCase]);

  la_respuesta := GetTicketBaiResponse(XMLDocument1);
  .......
Responder Con Cita
  #9  
Antiguo 21-09-2021
Avatar de HerensugeBeltz
HerensugeBeltz HerensugeBeltz is offline
Miembro
 
Registrado: may 2021
Ubicación: Hondarribia
Posts: 90
Poder: 6
HerensugeBeltz Va por buen camino
Hola Juramisa,
Olvida el timeout. Ese timeout tan corto no lo uso en los envíos de facturas, sólo lo hago para probar si el servicio está activo enviando un xml vacío.


Código:
   ...
    // Cambio el timeout por defecto
  // SocketDNSTotalTimeout (0): The timeout (in milliseconds) for the whole resolution process
  // SocketTimeout (60000): The maximum period of waiting, in milliseconds, after which the socket operation is considered unsuccessful.
   
   -- Sólo para probar que el servicio esté activo enviando un xml vacío --
    sbxHTTPClient1->SocketDNSTotalTimeout= 2000;
    sbxHTTPClient1->SocketTimeout= 2500;

    sbxHTTPClient1->PostBytes(endPoint, cnt);
   ...
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
SII -Nuevo sistema de la Agencia Tributaria española de envío de datos vía Webservice newtron Internet 3716 19-01-2026 20:01:34
Como utilizar la ayuda del nuevo Sistema Operativo gluglu Humor 3 24-09-2007 09:39:05
Aplicacion Agencia De Viajes ArdiIIa Varios 9 20-01-2007 16:49:53
El Vasco Aguirre Al González La Taberna 5 26-05-2006 09:22:28
Microsoft ha lanzado su nuevo sistema operativo DarkByte Humor 0 25-01-2004 09:21:14


La franja horaria es GMT +2. Ahora son las 16:32:53.


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