Example #1
0
        static void Main(string[] args)
        {
            MathsOperationsClient client = new MathsOperationsClient();

            Console.WriteLine(client.Add(100, 101));
            Console.WriteLine(client.Multiply(100, 101));
            Console.ReadLine();
            client.Close();
        }
        static void Main(string[] args)
        {
            MathsOperationsClient clientSOAP1 = new MathsOperationsClient("SOAPEndPoint1");
            MathsOperationsClient clientSOAP2 = new MathsOperationsClient("SOAPEndPoint2");
            MathsOperationsClient clientSOAP3 = new MathsOperationsClient("SOAPEndPoint3");

            Console.WriteLine("Client SOAP 1");
            Console.WriteLine("1 + 2 = {0}", clientSOAP1.Add(1, 2));
            Console.WriteLine("2 x 2 = {0}", clientSOAP1.Multiply(2, 2));
            Console.WriteLine("5 - 3 = {0}", clientSOAP1.Subtract(5, 3));
            Console.WriteLine("3 / 4 = {0}\n", clientSOAP1.Divide(3, 4));

            Console.WriteLine("Client SOAP 2");
            Console.WriteLine("1 + 4 = {0}", clientSOAP2.Add(1, 4));
            Console.WriteLine("2 x 2 = {0}", clientSOAP2.Multiply(2, 2));
            Console.WriteLine("5 - 10 = {0}", clientSOAP2.Subtract(5, 10));
            Console.WriteLine("3 / 4 = {0}\n", clientSOAP2.Divide(3, 4));

            Console.WriteLine("Client SOAP 3");
            Console.WriteLine("1 + 4 = {0}", clientSOAP3.Add(1, 4));
            Console.WriteLine("2 x 2 = {0}", clientSOAP3.Multiply(2, 2));
            Console.WriteLine("5 - 10 = {0}", clientSOAP3.Subtract(5, 10));
            Console.WriteLine("3 / 4 = {0}\n", clientSOAP3.Divide(3, 4));

            clientSOAP1.Close();
            clientSOAP2.Close();
            clientSOAP3.Close();

            Console.WriteLine("REST Call : Substraction (10 - 9)");
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:8733/Design_Time_Addresses/MathsLibrary/MathsOperations/RESTEndPoint/Subtract?x=10&y=9");

            //Get the Web Response
            HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
            Stream          responseStream = response.GetResponseStream();

            //Setting up the Stream Reader
            StreamReader readerStream   = new StreamReader(responseStream, System.Text.Encoding.GetEncoding("utf-8"));
            string       responseString = readerStream.ReadToEnd();

            readerStream.Close();

            Console.WriteLine(responseString);

            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Console.WriteLine(" MathsOperations Client pour SoapEndPnt1 ");
            MathsOperationsClient mathsOperationsClient_1 = new MathsOperationsClient("SoapEndPnt1");

            simpleTest(mathsOperationsClient_1);
            mathsOperationsClient_1.Close();


            Console.WriteLine(" MathsOperations Client pour SoapEndPnt2 ");
            MathsOperationsClient mathsOperationsClient_2 = new MathsOperationsClient("SoapEndPnt2");

            simpleTest(mathsOperationsClient_2);
            mathsOperationsClient_2.Close();


            Console.WriteLine(" MathsOperations Client pour SoapEndPnt3 ");
            MathsOperationsClient mathsOperationsClient_3 = new MathsOperationsClient("SoapEndPnt3");

            simpleTest(mathsOperationsClient_3);
            mathsOperationsClient_3.Close();



            Console.WriteLine(" MathsOperations Client pour RestEndPnt1 ");
            Console.WriteLine("REST Call : Add (8 + 12)");
            HttpWebRequest  request        = (HttpWebRequest)WebRequest.Create("http://localhost:8733/Design_Time_Addresses/MathsLibrary/MathsOperations/Rest/Add?x=8&y=12");
            HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
            Stream          responseStream = response.GetResponseStream();
            StreamReader    readerStream   = new StreamReader(responseStream, System.Text.Encoding.GetEncoding("utf-8"));
            string          responseString = readerStream.ReadToEnd();

            readerStream.Close();
            Console.WriteLine(responseString);

            Console.ReadLine();
        }