Exemple #1
0
 public static ITRetConsStatServ ConsultarStatusServidor(SoapHttpClientProtocol oServico, ITConsStatServ oConsStatServ, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetConsStatServ, ITConsStatServ>(oServico, TService.Status, oConsStatServ, oParam, versao, "TRetConsStatServ"));
 }
Exemple #2
0
 public Hosts(string url)
 {
     SoapHttpClientProtocol     = new hosts();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
        public static KeyValuePair <string, ITRetConsCad> Interface_ConsultarCadastro(SoapHttpClientProtocol oServico, ITConsCad oEnviNFe3, Parametro oParam, VersaoXML versao)
        {
            var Key = ExecutaServico(oServico, oEnviNFe3, oParam);

            try
            {
                var Value = (ITRetConsCad)XMLUtils.CarregaXML_STR(Key, versao, "TRetConsCad");
                return(new KeyValuePair <string, ITRetConsCad>(Key, Value));
            }
            catch (Exception ex)
            {
                Key = ex.Message + " - " + Key;
                return(new KeyValuePair <string, ITRetConsCad>(Key, null));
            }
        }
Exemple #4
0
 public static TConfigUf GNREConfigUF(SoapHttpClientProtocol oServico, TConsultaConfigUf xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <TConfigUf, TConsultaConfigUf>(oServico, TService.GNRE_ConsultaLote, xmlEnvio, oParam, oParam.versao, "TConfigUf"));
 }
 public Userif(string url)
 {
     SoapHttpClientProtocol     = new userif();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
Exemple #6
0
 public static ITRetConsCad ConsultarCadastro(SoapHttpClientProtocol oServico, ITConsCad oEnviNFe3, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetConsCad, ITConsCad>(oServico, TService.Cadastro, oEnviNFe3, oParam, versao, "TRetConsCad"));
 }
Exemple #7
0
 public static ITRetDownloadNFe DownloadNF(SoapHttpClientProtocol oServico, ITDownloadNFe xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetDownloadNFe, ITDownloadNFe>(oServico, TService.DownloadNF, xmlEnvio, oParam, versao, "TRetDownloadNFe"));
 }
 public Webdav(string url)
 {
     SoapHttpClientProtocol     = new x_webdav();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
 public Deviceinfo(string url)
 {
     SoapHttpClientProtocol     = new deviceinfo();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
 public static ITRetDownloadNFe DownloadNF(SoapHttpClientProtocol oServico, ITDownloadNFe xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return((ITRetDownloadNFe)XMLUtils.CarregaXML_STR(ExecutaServico(oServico, xmlEnvio, oParam),
                                                      versao, "TRetDownloadNFe"));
 }
Exemple #11
0
        public override void ParseWsdl(string wsdl, string service, object device)
        {
            DeviceCommand dev = (DeviceCommand)device;

            lock (this)
            {
                if (Importer == null)
                {
                    Importer = new WsdlImporter(dev);
                }
            }

            if (wsdl.EndsWith("0\r\n\r\n"))
            {
                wsdl = wsdl.Substring(0, wsdl.Length - 5);
            }

            DeviceCommand newDev = new DeviceCommand(dev);

            // Set the proxy server to our own application proxy in order to direct the http traffic to the USB device
            WebProxy2Usb usbProxy = WebProxy2Usb.GetProxy(newDev);
            IWebProxy    webProxy = new WebProxy(usbProxy.ProxyAddress, true);

            string compiled = Importer.LoadWsdl(wsdl, dev);

            if (compiled == null)
            {
                return;
            }

            dev.Logger.Add(new Log(LogType.DotNetAssembly, compiled));

            AssemblyImporter.AssemblyCommand[] webMethods = null;

            try
            {
                webMethods = AssemblyImporter.LoadAssembly(compiled);
            }
            catch (Exception e)
            {
                dev.Logger.Add(new Log(LogType.WEBError, e.Message));
                return;
            }

            newDev.Add(new DeviceCommand.ParentCommand(service));

            foreach (AssemblyImporter.AssemblyCommand method in webMethods)
            {
                try
                {
                    SoapHttpClientProtocol soapMethod = (SoapHttpClientProtocol)method.Class;
                    string url = soapMethod.Url;
                    int    pos = url.IndexOf("http://") + 7;
                    pos = url.IndexOf("/", pos);
                    if (pos > 0)
                    {
                        soapMethod.Url = usbProxy.ProxyAddress + url.Substring(pos);
                    }

                    newDev.Add(method);
                }
                catch (Exception e)
                {
                    dev.Logger.Add(new Log(LogType.WEBError, e.Message));
                }

                DeviceCommand.IssueChange(newDev, service + "'s Web Service Methods...");
            }
        }
 public static IRetDistDFeInt ConsultarDFe(SoapHttpClientProtocol oServico, IDistDFeInt xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return((IRetDistDFeInt)XMLUtils.CarregaXML_STR(ExecutaServico(oServico, xmlEnvio, oParam),
                                                    versao, "retDistDFeInt"));
 }
 public static ITRetConsCad ConsultarCadastro(SoapHttpClientProtocol oServico, ITConsCad oEnviNFe3, Parametro oParam, VersaoXML versao)
 {
     return((ITRetConsCad)XMLUtils.CarregaXML_STR(ExecutaServico(oServico, oEnviNFe3, oParam),
                                                  versao, "TRetConsCad"));
 }
        public static KeyValuePair <string, RDI.NFe2.GNRE.TConfigUf> Interface_GNREConfigUF(SoapHttpClientProtocol oServico,
                                                                                            RDI.NFe2.GNRE.TConsultaConfigUf xmlEnvio,
                                                                                            Parametro oParam,
                                                                                            VersaoXML versao)
        {
            var Key = ExecutaServico(oServico, xmlEnvio, oParam);

            try
            {
                var Value = (RDI.NFe2.GNRE.TConfigUf)XMLUtils.CarregaXML_STR(Key, versao, "TConfigUf");
                return(new KeyValuePair <string, RDI.NFe2.GNRE.TConfigUf>(Key, Value));
            }
            catch (Exception ex)
            {
                Key = ex.Message + " - " + Key;
                return(new KeyValuePair <string, RDI.NFe2.GNRE.TConfigUf>(Key, null));
            }
        }
Exemple #15
0
 public static ITRetInutNFe InutilizarNFe(SoapHttpClientProtocol oServico, ITInutNFe oInutNFe, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetInutNFe, ITInutNFe>(oServico, TService.Inutilizacao, oInutNFe, oParam, versao, "TRetInutNFe"));
 }
Exemple #16
0
 private WebService(SoapHttpClientProtocol svc)
 {
     _svc = svc;
     InitializeMethods();
 }
Exemple #17
0
 public static ITRetConsSitNFe ConsultarSituacaoNFe(SoapHttpClientProtocol oServico, ITConsSitNFe oConsSitNFe, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetConsSitNFe, ITConsSitNFe>(oServico, TService.ConsultaProtocolo, oConsSitNFe, oParam, versao, "TRetConsSitNFe"));
 }
Exemple #18
0
 public Tam(string url)
 {
     SoapHttpClientProtocol     = new x_tam();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
Exemple #19
0
 public static IRetDistDFeInt ConsultarDFe(SoapHttpClientProtocol oServico, IDistDFeInt xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <IRetDistDFeInt, IDistDFeInt>(oServico, TService.ConsultaDFe, xmlEnvio, oParam, versao, "retDistDFeInt"));
 }
Exemple #20
0
        private static String InternalExecutaServico(SoapHttpClientProtocol oServico, TService TipoServico, Object DADOS, Parametro oParam)
        {
            try
            {
                string dados = XMLUtils.GetXML(DADOS, oParam.versao);
                #region particularidades
                if (oParam.UF == TCodUfIBGE.Parana && (DADOS.GetType() == typeof(SchemaXML.NFe_v200.TEnviNFe) ||
                                                       DADOS.GetType() == typeof(SchemaXML.NFe_v300.TEnviNFe) ||
                                                       DADOS.GetType() == typeof(SchemaXML.NFe_v310.TEnviNFe) ||
                                                       DADOS.GetType() == typeof(SchemaXML.NFe_v400.TEnviNFe)))
                {
                    dados = dados.Replace("<NFe>", "<NFe xmlns=\"http://www.portalfiscal.inf.br/nfe\">");
                }
                #endregion
                XmlNode node = null;

                XmlDocument doc    = new XmlDocument();
                XmlReader   reader = XmlReader.Create(new StringReader(dados));
                reader.MoveToContent();

                node = doc.ReadNode(reader);

                InicializaServico(oServico, oParam);


                if (oParam.versao == VersaoXML.NFe_v400 &&
                    (TipoServico == TService.Autorizacao || TipoServico == TService.RetAutorizacao || TipoServico == TService.ConsultaProtocolo ||
                     TipoServico == TService.Inutilizacao || TipoServico == TService.RecepcaoEvento || TipoServico == TService.Cadastro || TipoServico == TService.Status))
                {
                    var wsMethod = Webservices.WSUtils.GetWSMethod(TipoServico);

                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(wsMethod, System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });
                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else
                {
                    //TODO : compatibilizar com a nova factory de webservices

                    if (DADOS.GetType() == typeof(TLote_GNRE))
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("processar",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType() == typeof(TConsLote_GNRE))
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("consultar",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType() == typeof(TConsultaConfigUf))
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("consultar",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("ITConsCad") != null)
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("consultaCadastro2",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("ITEnvEvento") != null)
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeRecepcaoEvento",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("ITEnviNFe") != null)
                    {
                        if (((ITEnviNFe)DADOS).versao == "2.00")
                        {
                            //versao 2.00

                            #region particularidades
                            if (oParam.UF == TCodUfIBGE.Parana)
                            {
                                if (oParam.tipoAmbiente == TAmb.Homologacao)
                                {
                                    oServico.Url = @"https://homologacao.nfe2.fazenda.pr.gov.br/nfe/NFeRecepcao2";
                                }
                                else
                                {
                                    oServico.Url = @"https://nfe2.fazenda.pr.gov.br/nfe/NFeRecepcao2";
                                }
                            }
                            #endregion

                            XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeRecepcaoLote2",
                                                                                   System.Reflection.BindingFlags.InvokeMethod,
                                                                                   null, oServico, new object[] { node });

                            return(XMLUtils.GetXML(ret, oParam.versao));
                        }
                        else
                        {
                            //versao 3.00
                            //Somente meto Assincrono
                            //var test = (SchemaXML300.TEnviNFe)DADOS;
                            //test.indSinc = SchemaXML300.TEnviNFeIndSinc.Item0;//Não indica sincrono
                            //test.indSinc = SchemaXML300.TEnviNFeIndSinc.Item1; //indica sincrono, mas depende da SEFAZ autorizadora implementar servico.

                            //***.**.Autorizacao.NfeAutorizacao proxy = new ***.**.Autorizacao.NfeAutorizacao();
                            //var ret = proxy.nfeAutorizacaoLote(node);
                            //sincrono poderá ter o Nó : TProtNFe
                            //assincrono terá o Nó : TRetEnviNFeInfRec

                            var fnNome = "nfeAutorizacaoLote";

                            XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                                   System.Reflection.BindingFlags.InvokeMethod,
                                                                                   null, oServico, new object[] { node });
                            return(XMLUtils.GetXML(ret, oParam.versao));
                        }
                    }
                    else if (DADOS.GetType().GetInterface("ITConsReciNFe") != null)
                    {
                        if (((ITConsReciNFe)DADOS).versao == "2.00")
                        {
                            //versao 2.00

                            #region particularidades
                            if (oParam.UF == TCodUfIBGE.Parana)
                            {
                                if (oParam.tipoAmbiente == TAmb.Homologacao)
                                {
                                    oServico.Url = @"https://homologacao.nfe2.fazenda.pr.gov.br/nfe/NFeRetRecepcao2";
                                }
                                else
                                {
                                    oServico.Url = @"https://nfe2.fazenda.pr.gov.br/nfe/NFeRetRecepcao2";
                                }
                            }
                            #endregion

                            XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeRetRecepcao2",
                                                                                   System.Reflection.BindingFlags.InvokeMethod,
                                                                                   null, oServico, new object[] { node });

                            return(XMLUtils.GetXML(ret, oParam.versao));
                        }
                        else
                        {
                            var fnNome = "nfeRetAutorizacaoLote";
                            if (oParam.UF == TCodUfIBGE.Parana && oParam.versao == VersaoXML.NFe_v310)
                            {
                                fnNome = "nfeRetAutorizacao";
                            }


                            //versao 3.00 ou 3.10
                            XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                                   System.Reflection.BindingFlags.InvokeMethod,
                                                                                   null, oServico, new object[] { node });

                            var temp = XMLUtils.GetXML(ret, oParam.versao);

                            if (oParam.UF == TCodUfIBGE.Pernambuco)
                            {
                                //SEFAZ PE está retornando retEnviNFe ao inves de retConsReciNFe quando lote ainda está em processamento
                                temp = temp.Replace("retEnviNFe", "retConsReciNFe");
                            }

                            return(temp);
                        }
                    }
                    else if (DADOS.GetType().GetInterface("ITConsStatServ") != null)
                    {
                        var fnNome = "nfeStatusServicoNF2";
                        if ((oParam.UF == TCodUfIBGE.Parana || oParam.UF == TCodUfIBGE.Bahia) &&
                            oParam.conexao == TipoConexao.NFe &&
                            oParam.tipoEmissao == TNFeInfNFeIdeTpEmis.Normal &&
                            oParam.versao == VersaoXML.NFe_v310)
                        {
                            fnNome = "nfeStatusServicoNF";
                        }

                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("ITInutNFe") != null)
                    {
                        var fnNome = "nfeInutilizacaoNF2";
                        if ((oParam.UF == TCodUfIBGE.Parana || oParam.UF == TCodUfIBGE.Bahia) &&
                            oParam.conexao == TipoConexao.NFe &&
                            oParam.tipoEmissao == TNFeInfNFeIdeTpEmis.Normal &&
                            oParam.versao == VersaoXML.NFe_v310)
                        {
                            fnNome = "nfeInutilizacaoNF";
                        }

                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("ITConsSitNFe") != null)
                    {
                        string fnNome = "nfeConsultaNF2";
                        if ((oParam.UF == TCodUfIBGE.Parana || oParam.UF == TCodUfIBGE.Bahia) &&
                            oParam.conexao == TipoConexao.NFe &&
                            oParam.tipoEmissao == TNFeInfNFeIdeTpEmis.Normal &&
                            oParam.versao == VersaoXML.NFe_v310)
                        {
                            fnNome = "nfeConsultaNF";
                        }

                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });
                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("IDistDFeInt") != null)
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeDistDFeInteresse",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else if (DADOS.GetType().GetInterface("ITDownloadNFe") != null)
                    {
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeDownloadNF",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else
                    {
                        throw new Exception("Tipo de objeto de envio não mapeado. Consulte o administrador do Sistema.");
                    }
                }
            }
            catch (Exception ex)
            {
                String msg = ex.Message;
                if (ex.InnerException != null)
                {
                    msg += " inner : " + ex.InnerException.Message;
                    if (ex.InnerException.InnerException != null)
                    {
                        msg += " inner : " + ex.InnerException.InnerException.Message;
                    }
                }

                throw new Exception("Erro ao executar Serviço : typeof(" + DADOS.GetType().ToString() + "). Verifique sua conexão com a Internet, configurações de proxy e certificado. " + msg);
            }
        }
Exemple #21
0
 public static TResultLote_GNRE GNREConsultaLote(SoapHttpClientProtocol oServico, TConsLote_GNRE xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <TResultLote_GNRE, TConsLote_GNRE>(oServico, TService.GNRE_ConsultaLote, xmlEnvio, oParam, oParam.versao, "TResultLote_GNRE"));
 }
Exemple #22
0
 public static ITRetEnvEvento EnviarEnvelopeEvento(SoapHttpClientProtocol oServico, ITEnvEvento oEnvEvento, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetEnvEvento, ITEnvEvento>(oServico, TService.RecepcaoEvento, oEnvEvento, oParam, versao, "TRetEnvEvento"));
 }
Exemple #23
0
 public Myfritz(string url)
 {
     SoapHttpClientProtocol     = new x_myfritz();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
Exemple #24
0
 public static ITRetEnviNFe EnviarEnvelope(SoapHttpClientProtocol oServico, ITEnviNFe oEnviNFe, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetEnviNFe, ITEnviNFe>(oServico, TService.Autorizacao, oEnviNFe, oParam, versao, "TRetEnviNFe"));
 }
Exemple #25
0
 public Wandslifconfig1(string url)
 {
     SoapHttpClientProtocol     = new wandslifconfig1();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
Exemple #26
0
 public static ITRetConsReciNFe ConsultarProcessamentoEnvelope(SoapHttpClientProtocol oServico, ITConsReciNFe oConsReciNFe, Parametro oParam, VersaoXML versao)
 {
     return(ExecutaServico <ITRetConsReciNFe, ITConsReciNFe>(oServico, TService.RetAutorizacao, oConsReciNFe, oParam, versao, "TRetConsReciNFe"));
 }
Exemple #27
0
 public Lanhostconfigmgm(string url)
 {
     SoapHttpClientProtocol     = new lanhostconfigmgm();
     SoapHttpClientProtocol.Url = url + "/tr064" + ControlURL;
 }
        public static KeyValuePair <string, RDI.NFe2.SchemaXML.GNRE.TResultLote_GNRE> Interface_GNREConsultaLote(SoapHttpClientProtocol oServico, TConsLote_GNRE xmlEnvio, Parametro oParam)
        {
            var Key = ExecutaServico(oServico, xmlEnvio, oParam);

            try
            {
                var Value = XMLUtils.LoadXML <TResultLote_GNRE>(Key);
                return(new KeyValuePair <string, TResultLote_GNRE>(Key, Value));
            }
            catch (Exception ex)
            {
                Key = ex.Message + " - " + Key;
                return(new KeyValuePair <string, TResultLote_GNRE>(Key, null));
            }
        }