![]() |
![]() |
| 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
|
|||
|
|||
|
Cita:
Hola ermendalenda como lo haces para obtener toda la respuesta html completa en el caso de un error en el certificado? Acabo de hacer la prueba con un certificado no válido y ha saltado una excepción al enviar, de tipo ProtocolException y en el mensaje hay los primeros 1024 caracteres de lo que has posteado tu pero no está entero y no puedo ver la parte del error de certificado. Dice solo esto: Código PHP:
Yo utilizo C# .Net Muchas gracias |
|
#2
|
||||
|
||||
|
Cita:
Sobretodo ahora que aveces responden el nuevo campo type vacio y da error. |
|
#3
|
|||
|
|||
|
Cita:
Gracias |
|
#4
|
|||
|
|||
|
Me apunto a la explicacion
|
|
#5
|
|||
|
|||
|
si trabajais con Delphi, en el componente HTTPRIO que hace el envío, evento OnAfterExecute:
ahí os guarda la respuesta en la ruta que indiquéis |
|
#6
|
|||
|
|||
|
Sabéis si han cambiado algo respecto al calculo de la huella digital. ???
De repente me dice que no coincide. esto es lo que indica la respuesta de AEAT DescripcionErrorRegistro>El cálculo de la huella suministrada es incorrecta. Datos de entrada cálculo huella: IDEmisorFactura=33461360V&NumSerieFactura=02-2024-13784&FechaExpedicionFactura=21-10-2024&TipoFactura=F1&CuotaTotal=1.81&ImporteTotal=10.45&Huella=C0E0A0F622EFF0A77A41E4 7C13972AEAB8E05A85E81D6B873942238A1A670BC5&FechaHoraHusoGenRegistro=2024-10-22T11:15:05+02:00 Huella calculada: 12EB4A6836E721DB0737F03A04EBDFF73D35B3A3D097F549548F00A259C65AFD |
|
#7
|
||||
|
||||
|
Cita:
Cita:
Hola, he implementado esta funcion , si la de aeat da error de serializacion o otro no interpretable uso esta. Código:
/// <summary>
/// Envio del registro de la factura a la aeat
/// </summary>
/// <param name="facAPresentar">Registro creado con las funciones de la aeat.</param>
/// <param name="action">Accion a realizar por defecto registro alta</param>
/// <returns>Devuelve la respuesta completa de la aeat</returns>
public string consultaAEAT(RegFactuSistemaFacturacion facAPresentar,string action = "RegistroAlta")
{
XmlSerializer serializaFactura = new XmlSerializer(typeof(RegFactuSistemaFacturacion));
string facXml = "";
using (var xmlw = new StringWriter())
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.Encoding = Encoding.UTF8;
using (XmlWriter writter = XmlWriter.Create(xmlw, settings))
{
serializaFactura.Serialize(writter, facAPresentar);
facXml = xmlw.ToString();
}
}
facXml = facXml.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soapenv:Header /> <soapenv:Body >");
facXml = facXml.Replace("<RegFactuSistemaFacturacion xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">", "<RegFactuSistemaFacturacion xmlns=\"https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd\">");
//facXml = facXml.Replace("</SistemaInformatico>", "</SistemaInformatico> \r\n <FechaHoraHusoGenRegistro xmlns=\"https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd\">" + timeStamp +"</FechaHoraHusoGenRegistro>");
facXml = facXml + " </soapenv:Body> </soapenv:Envelope > ";
////////////////////////// <----- Prueba extraccion sin serializar
XmlDocument doc = new XmlDocument();
doc.LoadXml(facXml.Replace("utf-16", "utf-8"));
HttpWebRequest webRequest = CreateWebRequest("https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP", action);
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
X509Certificate2 certificate = new X509Certificate2(Program.certificado, Program.passcertificado); //requiere estas variables globalescontienen el certificado y su clave
var tiempo = certificate.SubjectName;
if (certificate == null)
throw new ArgumentNullException(
"Certificate is null. Maybe serial number in configuration was wrong.");
if (certificate.NotAfter < DateTime.Now)
throw new ArgumentNullException(
$"Certificate is out of date. NotAfter: {certificate.NotAfter}.");
webRequest.ClientCertificates.Add(certificate);
using (Stream stream = webRequest.GetRequestStream())
{
doc.Save(stream);
}
HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
string statusDescription = response.StatusDescription;
Stream dataStream = response.GetResponseStream();
string responseFromServer;
using (StreamReader reader = new StreamReader(dataStream))
{
responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
}
return responseFromServer;
//retorno = client.RegFactuSistemaFacturacion(facAPresentar);
}
|
|
#8
|
||||
|
||||
|
Cita:
|
|
#9
|
|||
|
|||
|
Buenos días a todos,
Estoy usuando el programa de ejemplo para probar de hacer envíos y, al recibir la respuesta, no soy capaz de convertirla correctamente a un objeto del tipo RespuestaBaseType. EL problema lo tengo al acceder a las líneas de respuesta. Con Length(RespuestaBaseType.RespuestaLinea) me devuelve 0, como si fuese un array vacío pero el xml recibido si que tiene líneas. Para ver la respuesta que recibo uso el código de pablog2k:
Estoy recibiendo el siguiente xml: Código:
<env:Envelope> <env:Header/> <env:Body Id="Body"> <tikR:RespuestaRegFactuSistemaFacturacion> <tikR:Cabecera> <tik:ObligadoEmision> <tik:NombreRazon>EMPRSA SL</tik:NombreRazon> <tik:NIF>NIFF</tik:NIF> </tik:ObligadoEmision> </tikR:Cabecera> <tikR:TiempoEsperaEnvio>60</tikR:TiempoEsperaEnvio> <tikR:EstadoEnvio>Incorrecto</tikR:EstadoEnvio> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240001</tik:NumSerieFactura> <tik:FechaExpedicionFactura>21-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Alta</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1123</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro>El formato del NIF es incorrecto.. NIF:NIFCLI1.</tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240002</tik:NumSerieFactura> <tik:FechaExpedicionFactura>22-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Alta</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1123</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro>El formato del NIF es incorrecto.. NIF:NIFCLI2.</tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240001</tik:NumSerieFactura> <tik:FechaExpedicionFactura>21-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Anulacion</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1177</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro> El valor de campo IdSistemaInformatico del bloque SistemaInformatico es incorrecto. </tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240003</tik:NumSerieFactura> <tik:FechaExpedicionFactura>22-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Alta</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1123</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro>El formato del NIF es incorrecto.. NIF:NIFCLI2.</tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240004</tik:NumSerieFactura> <tik:FechaExpedicionFactura>22-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Alta</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1123</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro>El formato del NIF es incorrecto.. NIF:NIFCLI2.</tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240005</tik:NumSerieFactura> <tik:FechaExpedicionFactura>22-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Alta</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1123</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro>El formato del NIF es incorrecto.. NIF:NIFCLI2.</tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> <tikR:RespuestaLinea> <tikR:IDFactura> <tik:IDEmisorFactura>NIFF</tik:IDEmisorFactura> <tik:NumSerieFactura>F240006</tik:NumSerieFactura> <tik:FechaExpedicionFactura>22-01-2024</tik:FechaExpedicionFactura> </tikR:IDFactura> <tikR:Operacion> <tik:TipoOperacion>Alta</tik:TipoOperacion> </tikR:Operacion> <tikR:EstadoRegistro>Incorrecto</tikR:EstadoRegistro> <tikR:CodigoErrorRegistro>1123</tikR:CodigoErrorRegistro> <tikR:DescripcionErrorRegistro>El formato del NIF es incorrecto.. NIF:NIFCLI2.</tikR:DescripcionErrorRegistro> </tikR:RespuestaLinea> </tikR:RespuestaRegFactuSistemaFacturacion> </env:Body> </env:Envelope> Muchas gracias! |
|
#10
|
|||
|
|||
|
duda
Hola buenas
Estoy recreando la aplicacion de verifactu que esta colgada en este foro pero en python y ahora estoy con la parte de enviar el certificado y un xml de prueba que genero a partir de un excel. El problema que tengo es que a la hora de enviar la facturas me sale este error HTTPSConnectionPool(host='prewww1.aeat.es', port=443): Max retries exceeded with url: /wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP (Caused by SSLError(SSLError(524297, '[SSL] PEM lib (_ssl.c:3895)'))) La cosa es que no se si puede ser porque al estar usando un certificado que genere yo con openssl y un xml pero sin las caracteristicas de verifactu me esta dando el error porque el server no acepta eso o es porque tengo que usar una URL diferente para pruebas. Muchas gracias |
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Hijo de Informáticos | gluglu | Humor | 3 | 13-03-2007 11:05:35 |
| Adictos informaticos ... | Trigger | Humor | 2 | 11-10-2004 12:18:32 |
| Nosotros los Informáticos | Trigger | Humor | 1 | 10-10-2004 14:58:09 |
| Patrón de los Informáticos. | obiwuan | Varios | 20 | 10-09-2003 14:44:54 |
| Chistes Informaticos | jhonny | Humor | 2 | 11-08-2003 21:59:09 |
|