How to send an XML from an Nfec to the Sefaz homologation server using C# via the Nfeauthorization website?

Asked

Viewed 152 times

1

I already added the references in the project, my code is like this:

 public string EnviaSefaz(XmlNode xml, string url, string metodo)
    {
        try
        {

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            Servico01.NfeAutorizacao autorizar = new Servico01.NfeAutorizacao();

            Servico01.nfeCabecMsg cabecalho = new Servico01.nfeCabecMsg();

            cabecalho.cUF = "29";
            cabecalho.versaoDados = "3.10";


            autorizar.ClientCertificates.Add(Obter());


            string retorno = autorizar.nfeAutorizacaoLote(xml).InnerText;


            return retorno;
        }
        catch (WebException ex)
        {
            throw;
        }
    }

the result of this return variable is always: "2SEFAZBA_NFENW_v6.0.0999Rejection: Unmodified error292018-05-03T23:57:40-03:00"

Webservice: https://hnfe.sefaz.ba.gov.br/webservices/NfeAutorizacao/NfeAutorizacao.asmx

Do you have any suggestions of what it might be? I have already checked on the web site...

grateful for the attention...

1 answer

0

I don’t know if that’s what’s causing the error, but you’re using the protocol TLS 1.2 (SecurityProtocolType.Tls12) for an Nfe version 3.10.

As far as I know the version 3.10 uses the protocol SSL 2.0/3.0 (SecurityProtocolType.Ssl3).

The TSL would be used from the version 4.0.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.