Cita:
Empezado por juramisa
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;
}