1
I am updating the communication of NF-e for some customers and in general I am not having problems for authorizers like Rio Grande do Sul and São Paulo, for example.
But I’m not getting Goiás to work at all.
Namely, I made a simple Application Console, in which I inserted a Referral service for the Nfe Authorization service of Goiás (requires digital certificate):
https://homolog.sefaz.go.gov.br/nfe/services/NFeAutorizacao4?wsdl
The error happens whenever I call the remote method "nfeAuthorization": System.ServiceModel.Security.Securitynegotiationexception: 'It was not possible to establish a secure channel for SSL/TLS with authority 'Homolog.sefaz.go.gov.br'.'
Namely: the certificate chain is properly installed.
One thing I found strange is that although the wsdl is on an HTTPS, the endpoint solved by the service is http.
<client>
<endpoint address="http://homolog.sefaz.go.gov.br:80/nfe/services/NFeAutorizacao4"
binding="customBinding" bindingConfiguration="NFeAutorizacao4ServiceBinding"
contract="Hom.Goias.NFeAutorizacao4Service" name="NFeAutorizacao4Port" />
</client>
If I force https, my mistake is timeout.
My code goes below:
static void Main(string[] args)
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
var client = new Hom.Goias.NFeAutorizacao4ServiceClient();
client.ClientCredentials.ClientCertificate.Certificate =
new System.Security.Cryptography.X509Certificates.X509Certificate2(@"D:\Projects\XPTO\CERT.pfx", "SENHADOCERTIFICADO");
var xdoc = new XmlDocument();
xdoc.Load(@"d:\Projects\XPTO\nfe-go.xml");
var resp = client.nfeAutorizacaoLote(xdoc);
Console.ReadKey();
}
Any suggestion is welcome!