Example #1
0
        static void Main(string[] args)
        {
            wsAutenticacionSoapClient Autentica = new wsAutenticacionSoapClient();
            string Token = Autentica.AutenticarBasico("demo", "123456789");
            IwsAccountClient Account = new IwsAccountClient();

            //Debido a que se usa un certificado de pruebas, se debe agregar este bloque de codigo
            ServicePointManager.ServerCertificateValidationCallback +=
                delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
                {
                    return true;
                };
            using (new OperationContextScope(Account.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = new HttpRequestMessageProperty()
                {
                    Headers = { { "token", Token } }
                };
                try
                {
                    SaldoCliente Saldo = Account.GetSaldoClientById(null);
                    Console.WriteLine(Saldo.SaldoTimbres);
                    Console.WriteLine(Saldo.TimbresUtilizados);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                finally
                {
                    Pause();
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            wsAutenticacionSoapClient Autentica = new wsAutenticacionSoapClient();
            string           Token   = Autentica.AutenticarBasico("demo", "123456789");
            IwsAccountClient Account = new IwsAccountClient();

            //Debido a que se usa un certificado de pruebas, se debe agregar este bloque de codigo
            ServicePointManager.ServerCertificateValidationCallback +=
                delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
            {
                return(true);
            };
            using (new OperationContextScope(Account.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = new HttpRequestMessageProperty()
                {
                    Headers = { { "token", Token } }
                };
                try
                {
                    SaldoCliente Saldo = Account.GetSaldoClientById(null);
                    Console.WriteLine(Saldo.SaldoTimbres);
                    Console.WriteLine(Saldo.TimbresUtilizados);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                finally
                {
                    Pause();
                }
            }
        }