Ir para conteúdo
Fórum Script Brasil

Guigui Brito

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Posts postados por Guigui Brito

  1. Boa noite

    Estou precisando de um favor, alguém pode adaptar esse código  consumir web service da NFe 3.10 para a 4.0.

     //Consumir WebService
                    switch (NFe.Properties.Settings.Default.NFE_UF)
                    {
                        case "DF": //53
                            {
                                switch (NFe.Properties.Settings.Default.NFE_tpAmb)
                                {
                                    case "1": //Produção
                                        {
                                          //  NFe.P_SVRS_NFeConsultaProtocolo2.nfeCabecMsg wsCab_SVRS = new NFe.P_SVRS_NFeConsultaProtocolo2.nfeCabecMsg();
                                          //  NFe.P_SVRS_NFeConsultaProtocolo2.NfeConsulta2 wsSer_SVRS = new NFe.P_SVRS_NFeConsultaProtocolo2.NfeConsulta2();

                                          //  NFe.P_DF_SVRS_NFeConsulta.nfeCabecMsg wsCab_SVRS = new NFe.P_DF_SVRS_NFeConsulta.nfeCabecMsg();
                                          //  NFe.P_DF_SVRS_NFeConsulta.NfeConsulta2 wsSer_SVRS = new NFe.P_DF_SVRS_NFeConsulta.NfeConsulta2();
                                            NFe.PROD_NFCE_DF_CONS.nfeCabecMsg wsCab_SVRS = new NFe.PROD_NFCE_DF_CONS.nfeCabecMsg();
                                            NFe.PROD_NFCE_DF_CONS.NfeConsulta2 wsSer_SVRS = new NFe.PROD_NFCE_DF_CONS.NfeConsulta2();


                                            wsCab_SVRS.cUF = NFe.Properties.Settings.Default.NFE_cUF;
                                          //  wsCab_SVRS.versaoDados = "3.10";
                                            wsCab_SVRS.versaoDados = "2.01";

                                            wsSer_SVRS.nfeCabecMsgValue = wsCab_SVRS;

                                            // Adicionar o Certificado Digital
                                            wsSer_SVRS.ClientCertificates.Add(certificado);

                                            XmlNode xmlDados_SVRS;
                                            xmlDados_SVRS = xml_ConsSitNFe.DocumentElement;

                                            xml_retornado.LoadXml(wsSer_SVRS.nfeConsultaNF2(xmlDados_SVRS).OuterXml);

                                            xml_retornado.Save(nome_completo_xml_nfe_retornado);

                                            MessageBox.Show(xml_retornado.OuterXml.ToString());

                                            break;
                                        }
                                    case "2": //Homologação
                                        {
                                          //  NFe.HOMOL_NfeConsultaProtocolo2.nfeCabecMsg wsCab_DF = new NFe.HOMOL_NfeConsultaProtocolo2.nfeCabecMsg();
                                          //  NFe.HOMOL_NfeConsultaProtocolo2.NfeConsulta2 wsSer_DF = new NFe.HOMOL_NfeConsultaProtocolo2.NfeConsulta2();

                                          //  NFe.H_DF_SVRS_ConsultaProtocolo2.nfeCabecMsg wsCab_DF = new NFe.H_DF_SVRS_ConsultaProtocolo2.nfeCabecMsg();
                                          //  NFe.H_DF_SVRS_ConsultaProtocolo2.NfeConsulta2 wsSer_DF = new NFe.H_DF_SVRS_ConsultaProtocolo2.NfeConsulta2();

                                            br.gov.rs.svrs.nfce_homologacao_consulta.nfeCabecMsg wsCab_DF = new br.gov.rs.svrs.nfce_homologacao_consulta.nfeCabecMsg();
                                            br.gov.rs.svrs.nfce_homologacao_consulta.NfeConsulta2 wsSer_DF = new br.gov.rs.svrs.nfce_homologacao_consulta.NfeConsulta2();
                                   

                                            wsCab_DF.cUF = NFe.Properties.Settings.Default.NFE_cUF;
                                            wsCab_DF.versaoDados = "2.01";
                                        //    wsCab_DF.versaoDados = "3.10";

                                            wsSer_DF.nfeCabecMsgValue = wsCab_DF;

                                            // Adicionar o Certificado Digital
                                            wsSer_DF.ClientCertificates.Add(certificado);

                                            XmlNode xmlDados;
                                            xmlDados = xml_ConsSitNFe.DocumentElement;

                                            xml_retornado.LoadXml(wsSer_DF.nfeConsultaNF2(xmlDados).OuterXml);

                                            xml_retornado.Save(nome_completo_xml_nfe_retornado);

                                            MessageBox.Show(xml_retornado.OuterXml.ToString());

                                            break;
                                        }
                                }
                                break;
                            }

     

  2. Estou precisando  dos códigos em C# da parte de consumir web services para a  NFe 4.0. Por favor alguém que  já tenha pronto ou q se disponibilize a criar entre em contato por favor.

    VEJA O CODIGO QUE ESTOU USANDO PARA A NFe 3.10

     

     //Consumir WebService
                    switch (NFe.Properties.Settings.Default.NFE_UF)
                    {
                        case "DF": //53
                            {
                                switch (NFe.Properties.Settings.Default.NFE_tpAmb)
                                {
                                    case "1": //Produção
                                        {
                                          //  NFe.P_SVRS_NFeConsultaProtocolo2.nfeCabecMsg wsCab_SVRS = new NFe.P_SVRS_NFeConsultaProtocolo2.nfeCabecMsg();
                                          //  NFe.P_SVRS_NFeConsultaProtocolo2.NfeConsulta2 wsSer_SVRS = new NFe.P_SVRS_NFeConsultaProtocolo2.NfeConsulta2();

                                          //  NFe.P_DF_SVRS_NFeConsulta.nfeCabecMsg wsCab_SVRS = new NFe.P_DF_SVRS_NFeConsulta.nfeCabecMsg();
                                          //  NFe.P_DF_SVRS_NFeConsulta.NfeConsulta2 wsSer_SVRS = new NFe.P_DF_SVRS_NFeConsulta.NfeConsulta2();
                                            NFe.PROD_NFCE_DF_CONS.nfeCabecMsg wsCab_SVRS = new NFe.PROD_NFCE_DF_CONS.nfeCabecMsg();
                                            NFe.PROD_NFCE_DF_CONS.NfeConsulta2 wsSer_SVRS = new NFe.PROD_NFCE_DF_CONS.NfeConsulta2();


                                            wsCab_SVRS.cUF = NFe.Properties.Settings.Default.NFE_cUF;
                                          //  wsCab_SVRS.versaoDados = "3.10";
                                            wsCab_SVRS.versaoDados = "2.01";

                                            wsSer_SVRS.nfeCabecMsgValue = wsCab_SVRS;

                                            // Adicionar o Certificado Digital
                                            wsSer_SVRS.ClientCertificates.Add(certificado);

                                            XmlNode xmlDados_SVRS;
                                            xmlDados_SVRS = xml_ConsSitNFe.DocumentElement;

                                            xml_retornado.LoadXml(wsSer_SVRS.nfeConsultaNF2(xmlDados_SVRS).OuterXml);

                                            xml_retornado.Save(nome_completo_xml_nfe_retornado);

                                            MessageBox.Show(xml_retornado.OuterXml.ToString());

                                            break;
                                        }
                                    case "2": //Homologação
                                        {
                                          //  NFe.HOMOL_NfeConsultaProtocolo2.nfeCabecMsg wsCab_DF = new NFe.HOMOL_NfeConsultaProtocolo2.nfeCabecMsg();
                                          //  NFe.HOMOL_NfeConsultaProtocolo2.NfeConsulta2 wsSer_DF = new NFe.HOMOL_NfeConsultaProtocolo2.NfeConsulta2();

                                          //  NFe.H_DF_SVRS_ConsultaProtocolo2.nfeCabecMsg wsCab_DF = new NFe.H_DF_SVRS_ConsultaProtocolo2.nfeCabecMsg();
                                          //  NFe.H_DF_SVRS_ConsultaProtocolo2.NfeConsulta2 wsSer_DF = new NFe.H_DF_SVRS_ConsultaProtocolo2.NfeConsulta2();

                                            br.gov.rs.svrs.nfce_homologacao_consulta.nfeCabecMsg wsCab_DF = new br.gov.rs.svrs.nfce_homologacao_consulta.nfeCabecMsg();
                                            br.gov.rs.svrs.nfce_homologacao_consulta.NfeConsulta2 wsSer_DF = new br.gov.rs.svrs.nfce_homologacao_consulta.NfeConsulta2();
                                   

                                            wsCab_DF.cUF = NFe.Properties.Settings.Default.NFE_cUF;
                                            wsCab_DF.versaoDados = "2.01";
                                        //    wsCab_DF.versaoDados = "3.10";

                                            wsSer_DF.nfeCabecMsgValue = wsCab_DF;

                                            // Adicionar o Certificado Digital
                                            wsSer_DF.ClientCertificates.Add(certificado);

                                            XmlNode xmlDados;
                                            xmlDados = xml_ConsSitNFe.DocumentElement;

                                            xml_retornado.LoadXml(wsSer_DF.nfeConsultaNF2(xmlDados).OuterXml);

                                            xml_retornado.Save(nome_completo_xml_nfe_retornado);

                                            MessageBox.Show(xml_retornado.OuterXml.ToString());

                                            break;
                                        }
                                }
                                break;
                            }

×
×
  • Criar Novo...