Occasional error when transmitting Nfce in the new Sefaz webservices of RS - Connection

Asked

Viewed 553 times

1

I have an Nfe and Nfce emission system that we use for several RS clients. A few months ago Sefaz here changed the structure of the webservices, so they also provided new Urls for access to the service (the old ones continue to work until the end of 2015). I already downloaded the certificate chain and imported it into our trusted certificate repository. I did some tests and had the following problem: Sometimes it works and sometimes it doesn’t! Sometimes I send 5 notes and all are issued without any problem, and suddenly starts to give error when connecting to WS. The error that happens (when it happens) is as follows:

INFO (11:19:42,368) - Unable to sendViaPost to url[https://nfce-homologacao.sefazrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx]
java.net.SocketException: Connection reset

I thought it might be something on my internet provider, but I tried to put in some customers and the same problem occurs. Sometimes it’s right and sometimes it’s wrong.

With the old URL everything worked 100%, this was when the old URL was used for both Nfe and Nfce. Now with the new ones they have separated the services, and the new one works perfectly, the problem is only in Nfce.

I talked to the people of Faz and according to them it is not a problem with them. However, they did not know why sometimes the connection is not accepted. I also believe it is not a problem in my code, since sometimes it works. But then I can’t be so sure. Does anyone know what could be going on?

  • I have the same problem. You managed to solve?

  • Yes, I did. Yesterday happened the problem in Nfe/Cte/Mdfe also, the solution posted as an answer to my question, take a look there and comment if it does not suit your case.

  • 1

    Disclaimer warning ahead: happy of those who live outside SP, who are not subject to buy such SAT with price tag to make NFC-e (leaves the lobby of tax printers, enters the lobby of the SAT for a half a dozen manufacturers fill the pocket of money in Main). I find the SAT very cool, since OPTIONAL.... (for those who do not know what it is, is a hardware that you are obliged to acquire for a real 1300 to be able to emit NFC-e in SP)

  • This is the government that we have... in a few months they suspend the Sat and find a way to make some more absurd bureaucracy that will be left to the taxpayer pay, and so follows the dance...

  • I also use it dynamic, and solved this way. I just do not understand, because in version 7 of java, it does not give error. Only in version 8. I solved on the same day of the hahaha question. Anyway, thanks Buddy.

1 answer

2


Solved. I was using a class called SocketFactoryDinamico, which was a custom socket, to communicate with SEFAZ services. Turns out in this class, there was a parameter that said what the security protocol was in communication, that when it went wrong, it was TLS. Switching to Tlsv1 solved the problem:

SSLContext sslContext = SSLContext.getInstance("TLSv1");  

This problem happened a few months ago for the Nfce in Rio Grande do Sul. Yesterday, day 05/11/2015, also started to occur for all other SEFAZ services (Nfe/Cte/Mdfe, etc). The same fix applies to all these services for those who also use dynamic/custom socket on connection.

Updating

Actually the error only happened from java 8, so if someone wants a temporary solution to the problem while not adjusting in the programming as I posted above, install java 7.

Browser other questions tagged

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