I'm trying to send a test of Reinf's R-1000 event and it returns me:
The remote server returned an error: (500) Internal Server Error. Processing failed. Please try again. Identifier: 3033699826
Can anyone help me?
Follow the code:
string xmlRequisicaoSOAP = MontarXmlRequisicao();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.URL);
//request.Headers.Add("SOAPAction", string.Format("\"{0}{1}\"", XMLNS, METODO));
request.Headers.Add("SOAPAction", @"https://preprodefdreinf.receita.fazenda.gov.br/RecepcaoLoteReinf.svc");
request.ContentType = "text/xml;charset=\"utf-8\"";
request.Accept = "text/xml";
request.Method = "POST";
// request.Proxy = proxy;
if (this.Certificado != null)
request.ClientCertificates.Add(this.Certificado);
if (this.TimeOutEmSegundos > 0)
request.Timeout = this.TimeOutEmSegundos * 1000;
this.UltimaRequisicao = xmlRequisicaoSOAP;
try
{
using (Stream stream = request.GetRequestStream())
{
using (StreamWriter stmw = new StreamWriter(stream))
{
stmw.Write(xmlRequisicaoSOAP);
}
}
}
catch (Exception wex)
{
throw new Exception(wex.Message);
}
try
{
WebResponse webresponse = request.GetResponse();
HttpWebResponse response = (HttpWebResponse)webresponse;
//if(response.StatusCode == HttpStatusCode.OK)
using (StreamReader responseReader = new StreamReader(response.GetResponseStream()))
{
string result = responseReader.ReadToEnd();
return result;
}
}
catch (WebException wex)
{
string mensagemSubjacente = ObterMensagemSubjacente(wex);
string msg = string.Format("{1}\r\n{0}\r\n Detalhes subjacentes: \r\n{2}",
System.Environment.NewLine, wex.Message, mensagemSubjacente);
throw new ExcecaoComunicacaoREINF(msg, wex, xmlRequisicaoSOAP);
// throw new Exception(wex.Message);
}
catch (Exception ex)
{
throw new ExcecaoComunicacaoREINF(ex.Message, ex, xmlRequisicaoSOAP);
}
}