C# How to read Nfe Send Return XML

Asked

Viewed 264 times

1

I’m implementing communication with the SEFAZ WS. After sending the Note, I am having difficulty obtaining XML content from the return in string format and reading the Receipt.("infRec") Follow print screen with the completed return, does anyone know how to convert this return and read the values as mentioned above ( String XML and Field Receipt)? Follow the requisition code.

        NfeAutorizacao.NfeAutorizacao aut = new NfeAutorizacao.NfeAutorizacao();
        aut.ClientCertificates.Add(certificado);

        nfeDadosMsg dados = new nfeDadosMsg();

        aut.nfeCabecMsgValue = new nfeCabecMsg();
        aut.nfeCabecMsgValue.cUF = "31";
        aut.nfeCabecMsgValue.versaoDados = "3.10";
        XmlDocument xml = new XmlDocument();
        xml.LoadXml(param);
        XmlNode newnode = xml.DocumentElement;
        Object[] res = aut.NfeAutorizacaoLote(newnode);

Código do retorno do envio inserir a descrição da imagem aqui

  • 1

    Welcome, I recommend making a [tour], in order to frame your question in the SO-pt model. Ideal is to post together with the question the code you already tried, for evaluation and more ease in solving the problem

  • Try this solution: http://answall.com/questions/50629/retorno-authorizing%C3%A7%C3%A3o-nfe-3-10-mg-c? noredirect=1&lq=1

  • What is the Exception that is returning to you?

  • @Thiagolunardi, none occurs. I need to take res[0] and save it in XML and then read the XML data field by field. I think I need to convert Xmlnode[] to an Xmlnode. How to do ?

  • Make a breakpoint, Shift+F9, make a watch on res and navigate to where you need it. You’ll see how to recover what you need.

  • @Thiagolunardi thanks for the help!! I had to serialize res[0] and save the content serialized XML file. It worked.

Show 1 more comment
No answers

Browser other questions tagged

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