Ejemplo n.º 1
0
        private bool _disposedValue; // To detect redundant calls

        private void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _proxy = null;
                }

                _disposedValue = true;
            }
        }
Ejemplo n.º 2
0
        private bool _disposedValue; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _proxy = null;
                }

                _disposedValue = true;
            }
        }
        public ConexionSunat(Parametros parametros)
        {
            System.Net.ServicePointManager.UseNagleAlgorithm = true;
            System.Net.ServicePointManager.Expect100Continue = false;
            System.Net.ServicePointManager.CheckCertificateRevocationList = true;

            _proxy    = new billServiceClient("ServicioSunat", parametros.EndPointUrl);
            Retencion = parametros.Retencion;

            // Agregamos el behavior configurado para soportar WS-Security.
            var behavior = new PasswordDigestBehavior(string.Concat(parametros.Ruc, parametros.UserName), parametros.Password);

            _proxy.Endpoint.EndpointBehaviors.Add(behavior);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor de la Clase ConexionSunat
        /// </summary>
        /// <param name="ruc">Numero de RUC del contribuyente</param>
        /// <param name="username">Usuario SOL</param>
        /// <param name="password">Clave SOL</param>
        /// <param name="endPointServicio">Nombre del Endpoint (Opcional)</param>
        public ConexionSunat(string ruc, string username, string password, string endPointServicio)
        {
            System.Net.ServicePointManager.UseNagleAlgorithm = true;
            System.Net.ServicePointManager.Expect100Continue = false;
            System.Net.ServicePointManager.CheckCertificateRevocationList = true;

            _proxy = new billServiceClient(new billServiceClient.EndpointConfiguration());


            // Agregamos el behavior configurado para soportar WS-Security.

            var behavior = new PasswordDigestBehavior(string.Concat(ruc, username), password);

            _proxy.Endpoint.EndpointBehaviors.Add(behavior);
        }
Ejemplo n.º 5
0
        void IServicioSunat.Inicializar(ParametrosConexion parametros)
        {
            System.Net.ServicePointManager.UseNagleAlgorithm = true;
            System.Net.ServicePointManager.Expect100Continue = false;
            System.Net.ServicePointManager.CheckCertificateRevocationList = true;

            _proxyConsultas = new billServiceClient(CreateBinding(), new EndpointAddress(parametros.EndPointUrl))
            {
                ClientCredentials =
                {
                    UserName     =
                    {
                        UserName = parametros.Ruc + parametros.UserName,
                        Password = parametros.Password
                    }
                }
            };
        }
Ejemplo n.º 6
0
        protected void btnEnviarSunat_Click(object sender, EventArgs e)
        {
            try
            {
                //var sunat = new WS_SUNAT.billServiceClient();
                //sunat.sendBill(@"D:\DESARROLLO\SMART\SMART.Presentacion\XML\CDA\Final\Casos con maxima informacion\20100066603-RC-20110522-1.xml", null);
                //lblMensaje.Text = "Exito";

                byte[] byteArray = File.ReadAllBytes(@"D:\DESARROLLO\SMART\SMART.Presentacion\XML\CDA\Final\Casos con maxima informacion" + "\\" + "20100066603-01-F001-1.zip");

                // WS_SUNAT.billServiceClient ws = new WS_SUNAT.billServiceClient();
                WS_BETA.billServiceClient ws = new billServiceClient();
                ws.Open();
                byte[] oRetorno;
                oRetorno        = ws.sendBill("20100066603-01-F001-1.zip", byteArray, "");
                lblMensaje.Text = "Exito";
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                lblMensaje.Text = "Error: " + exception.Message;
            }
        }
Ejemplo n.º 7
0
        protected string EnviarSoap(string fzip, out bool esError
                                    )
        {
            DocPdf threeDir = new DocPdf();
            //threeDir.crearDirectorio(fzip, fechaemision );
            var billService = new billServiceClient("BillServicePort.11");

            esError = false;
            var resp = "";

            try
            {
                var bytes = billService.sendBill(Path.GetFileName(fzip).Replace(".xml", ""), File.ReadAllBytes(fzip), "");
                //sCdrZip = System.Text.Encoding.Default.GetString(bytes);
                var rfzip = Path.Combine(Path.GetDirectoryName(fzip), "R-" + Path.GetFileName(fzip));
                File.WriteAllBytes(rfzip, bytes);
            }
            catch (Exception ex)
            {
                resp    = "Error: " + ex.Message;
                esError = true;
            }
            return(resp);
        }