Error sending NFe

1

I'm trying to issue NFe using SEFAZ RS's webservice, however it's generating some errors when I call the nfeAutorizacaoLote method. It looks like the error is in the webservice configuration.

By referencing URL for Visual Studio, the following configuration is created in the file web.config :

<system.serviceModel>
    <client>
        <endpoint address="https://nfe-homologacao.sefazrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx" 
        binding="basicHttpBinding" 
        bindingConfiguration="NfeAutorizacaoSoap" 
        contract="NFeAutorizacao.NfeAutorizacaoSoap" 
        name="NfeAutorizacaoSoap" />
    </client>
    <bindings>
        <basicHttpBinding>
            <binding name="NfeAutorizacaoSoap">
                <security mode="Transport" />
            </binding>
            <binding name="NfeAutorizacaoSoap1" />
        </basicHttpBinding>
    </bindings>
</system.serviceModel>

However you are returning the error below, I will call error1 :

  

The HTTP request is prohibited with the 'Anonymous' client authentication scheme

As I researched, one of the possibilities would be to change the configuration of:
<security mode="Transport" /> Home for: <security mode="TransportCredentialOnly"/>


However, just returned another error, I will call error2 :

  

The provider URI scheme 'https' is invalid; expected 'http'. \ r \ n Parameter name: via

I have already tested all possible settings for mode , and always returns either error1 or error2 . I performed a paralele test by XML validation service and everything is fine with the file, the problem is in the webservice request.

Here is the snippet of the requesting code:

try
{
    XmlDocument oXmlDoc = new XmlDocument();
    oXmlDoc.Load("c:\teste.xml");
    XmlNode oNode = oXmlDoc.DocumentElement;
    NFeAutorizacao.NfeAutorizacaoSoapClient oNfeAutorizacaoSoapClient = new NFeAutorizacao.NfeAutorizacaoSoapClient();
    NFeAutorizacao.nfeCabecMsg onfeCabecMsg = new NFeAutorizacao.nfeCabecMsg();
    onfeCabecMsg.versaoDados = "3.10";
    onfeCabecMsg.cUF = "43";
    XmlNode xmlnode = oNfeAutorizacaoSoapClient.nfeAutorizacaoLote(ref onfeCabecMsg, oNode);
}
catch (Exception exc)
{

}

Note: When you access the URL , you must have a digital certificate , otherwise it will return forbidden access: HTTP Error 403.7 - Forbidden: The page you are attempting to access requires your browser to have a Secure Sockets Layer (SSL) client certificate that the Web server recognizes.

    
asked by anonymous 08.08.2017 / 16:30

1 answer

2

I did not do it with permission, but I get my use of the distribution and event reception below webconfig configuration:

 <binding name="RecepcaoEventoSoap">
    <security mode="Transport">
        <transport clientCredentialType="Certificate" proxyCredentialType="None"/>
    </security>
 </binding>
    
08.08.2017 / 16:40