Exemple #1
0
        static void Main(string[] args)
        {
            ServicePointManager.DefaultConnectionLimit = 65535;

            var options = ProgramOptions.GetOptionsFromCommandLine(args);

            url       = options.url;
            cashBoxId = options.cashboxid.ToString();

            System.ServiceModel.Channels.Binding binding = null;

            if (url.StartsWith("http://"))
            {
                var b = new BasicHttpBinding(BasicHttpSecurityMode.None);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }
            else if (url.StartsWith("https://"))
            {
                var b = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }
            else if (url.StartsWith("net.pipe://"))
            {
                var b = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }
            else if (url.StartsWith("net.tcp://"))
            {
                var b = new NetTcpBinding(SecurityMode.None);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }

            var endpoint = new EndpointAddress(url);

            var factory = new ChannelFactory <IPOS>(binding, endpoint);

            proxy = factory.CreateChannel();


            // use echo for communication test
            var message = proxy.Echo("message");

            if (message != "message")
            {
                throw new Exception("echo failed");
            }

            while (true)
            {
                Menu();
            }
        }
Exemple #2
0
 private static void ExecuteEcho(string message)
 {
     try
     {
         var result = _pos.Echo(message);
         if (result != message)
         {
             throw new Exception("The Echo request did not return the expected result.");
         }
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex);
     }
 }
Exemple #3
0
        static void Main(string[] args)
        {
            ServicePointManager.DefaultConnectionLimit = 65535;

            Console.Write("fiskaltrust-service-url:");
            url = Console.ReadLine();

            Console.Write("cashboxid:");
            cashBoxId = Console.ReadLine();

            Guid _tempCashBoxID;

            if (!Guid.TryParse(cashBoxId, out _tempCashBoxID))
            {
                throw new ArgumentException("cashboxid is not a guid!");
            }

            System.ServiceModel.Channels.Binding binding = null;

            if (url.StartsWith("http://"))
            {
                var b = new BasicHttpBinding(BasicHttpSecurityMode.None);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }
            else if (url.StartsWith("https://"))
            {
                var b = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }
            else if (url.StartsWith("net.pipe://"))
            {
                var b = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }
            else if (url.StartsWith("net.tcp://"))
            {
                var b = new NetTcpBinding(SecurityMode.None);
                b.MaxReceivedMessageSize = 16 * 1024 * 1024;

                binding = b;
            }

            var endpoint = new EndpointAddress(url);

            var factory = new ChannelFactory <IPOS>(binding, endpoint);

            proxy = factory.CreateChannel();


            // use echo for communication test
            var message = proxy.Echo("message");

            if (message != "message")
            {
                throw new Exception("echo failed");
            }


            while (true)
            {
                Menu();
            }
        }
 public string Echo(string message) => _innerPOS.Echo(message);