Esempio n. 1
0
        static void XmlToJsonConsumer()
        {
            Console.WriteLine();
            Console.WriteLine("----- CONSUMING XMLTOJSON SERVICE -----");
            Console.WriteLine("XML = ");
            string inputString = Console.ReadLine();

            if (inputString.ToLower() == "exit")
            {
                toBeContinued = "exit";
                return;
            }
            string xml = inputString;

            Console.WriteLine();
            Console.WriteLine("Waitting for XmlToJson Service ...");

            try
            {
                var soapClient = new ChanhDuongAPI.ChuaNgotServiceSoapClient();
                var response   = soapClient.XmlToJson(xml);
                Console.WriteLine("Json of " + xml + " :");
                Console.WriteLine(response);
            }
            catch (Exception err)
            {
                Console.WriteLine("[Error] " + err.Message + " | " + err.StackTrace);
            }
        }
Esempio n. 2
0
        static void FibonacciConsumer()
        {
            Console.WriteLine();
            Console.WriteLine("----- CONSUMING FIBONACCI SERVICE -----");
            Console.WriteLine("N = ");
            string inputString = Console.ReadLine();

            if (inputString.ToLower() == "exit")
            {
                toBeContinued = "exit";
                return;
            }
            try
            {
                int n = Int32.Parse(inputString);
                Console.WriteLine();
                Console.WriteLine("Waitting for Fibonacci Service ...");

                try
                {
                    var soapClient = new ChanhDuongAPI.ChuaNgotServiceSoapClient();
                    var response   = soapClient.Fibonacci(n);
                    Console.WriteLine("Fibonacci of " + n + ": " + response);
                }
                catch (Exception err)
                {
                    Console.WriteLine("[Error] " + err.Message + " | " + err.StackTrace);
                }
            }
            catch (FormatException e)
            {
                Console.WriteLine(e.Message);
            }
        }