Beispiel #1
0
        static void Main()
        {
            Console.WriteLine("Username authentication required.");
            Console.WriteLine("Provide a username and a password that match (ex. username:test password:test)");
            Console.WriteLine("   Enter username:"******"   Enter password:"******"*");
            }

            Console.WriteLine();

            // <snippet1>
            // Create the binding.
            WSHttpBinding subsystemBinding = new WSHttpBinding();

            subsystemBinding.Security.Mode = SecurityMode.Message;
            subsystemBinding.Security.Message.ClientCredentialType =
                MessageCredentialType.UserName;

            // Create the endpoint address.
            EndpointAddress ea = new
                                 EndpointAddress("http://www.cohowinery.com:8000/FacadeService");


            CalculatorClient client = new CalculatorClient(subsystemBinding, ea);

            // Configure client with valid machine or domain account (username,password)
            client.ClientCredentials.UserName.UserName = username;
            client.ClientCredentials.UserName.Password = password.ToString();

            // Call the Multiply service operation.
            double value1 = 39D;
            double value2 = 50.44D;
            double result = client.Multiply(value1, value2);

            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();
            // </snippet1>
        }
Beispiel #2
0
        static void Main()
        {
            {
                // <Snippet1>
                // Configure custom certificate validation.
                ClientCredentials creds = new ClientCredentials();
                creds.ServiceCertificate.Authentication.CertificateValidationMode
                    = X509CertificateValidationMode.Custom;
                creds.ServiceCertificate.Authentication.CustomCertificateValidator
                    = new MyCertificateValidator();
                // </Snippet1>
            }
            {
                // <Snippet2>
                ClientCredentials creds = new ClientCredentials();

                // Configure chain trust.

                creds.ServiceCertificate.Authentication.CertificateValidationMode =
                    X509CertificateValidationMode.ChainTrust;

                creds.ServiceCertificate.Authentication.RevocationMode =
                    X509RevocationMode.NoCheck;
                // </Snippet2>
            }
            {
                // <Snippet3>
                ClientCredentials creds = new ClientCredentials();

                // Configure chain trust.
                creds.ServiceCertificate.Authentication.CertificateValidationMode
                    = X509CertificateValidationMode.ChainTrust;
                creds.ServiceCertificate.Authentication.TrustedStoreLocation
                    = StoreLocation.LocalMachine;
                // </Snippet3>
            }

            {
                // <Snippet4>
                ClientCredentials clientCreds =
                    new ClientCredentials();
                Console.WriteLine(
                    clientCreds.ServiceCertificate.Authentication);
                // </Snippet4>
            }

            // Create a client with given client endpoint configuration
            CalculatorClient wcfClient = new CalculatorClient();

            try
            {
                // set new credentials
                wcfClient.ChannelFactory.Endpoint.Behaviors.Remove(typeof(ClientCredentials));
                wcfClient.ChannelFactory.Endpoint.Behaviors.Add(new MyUserNameClientCredentials());

                /*
                 * Setting the CertificateValidationMode to PeerOrChainTrust means that if the certificate
                 * is in the Trusted People store, then it will be trusted without performing a
                 * validation of the certificate's issuer chain. This setting is used here for convenience so that the
                 * sample can be run without having to have certificates issued by a certificate authority (CA).
                 * This setting is less secure than the default, ChainTrust. The security implications of this
                 * setting should be carefully considered before using PeerOrChainTrust in production code.
                 */
                wcfClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
                    X509CertificateValidationMode.PeerOrChainTrust;
                // <Snippet0>
                ClientCredentials creds = new ClientCredentials();
                // Configure peer trust.
                creds.ServiceCertificate.Authentication.CertificateValidationMode =
                    X509CertificateValidationMode.PeerTrust;

                // Configure chain trust.
                creds.ServiceCertificate.Authentication.CertificateValidationMode =
                    X509CertificateValidationMode.ChainTrust;

                // Configure custom certificate validation.
                creds.ServiceCertificate.Authentication.CertificateValidationMode =
                    X509CertificateValidationMode.Custom;
                creds.ServiceCertificate.Authentication.CustomCertificateValidator =
                    new MyCertificateValidator();
                // </Snippet0>
                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = wcfClient.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = wcfClient.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = wcfClient.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = wcfClient.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
                wcfClient.Close();
            }
            catch (TimeoutException timeProblem)
            {
                Console.WriteLine("The service operation timed out. " + timeProblem.Message);
                Console.ReadLine();
                wcfClient.Abort();
            }
            catch (CommunicationException commProblem)
            {
                Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
                Console.ReadLine();
                wcfClient.Abort();
            }

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #3
0
        static void Main()
        {
            // Create a client with given client endpoint configuration. Make calls as Alice.
            CalculatorClient client = new CalculatorClient();

            // Set credentials to Alice
            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            try
            {
                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = client.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = client.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = client.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = client.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

                client.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e.Message);

                if (e.InnerException != null)
                {
                    Console.WriteLine("Inner Exception: {0}", e.InnerException.Message);
                }
            }

            // Create a client with given client endpoint configuration. Make calls as Bob.
            client = new CalculatorClient();

            try
            {
                // Set credentials to Bob
                client.ClientCredentials.UserName.UserName = "******";
                client.ClientCredentials.UserName.Password = "******";
                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = client.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = client.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = client.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = client.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

                client.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e.Message);

                if (e.InnerException != null)
                {
                    Console.WriteLine("Inner Exception: {0}", e.InnerException.Message);
                }
            }

            // Create a client with given client endpoint configuration. Make calls as Charlie.
            client = new CalculatorClient();

            try
            {
                // Set credentials to Charlie
                client.ClientCredentials.UserName.UserName = "******";
                client.ClientCredentials.UserName.Password = "******";
                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = client.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = client.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = client.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = client.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

                client.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e.Message);

                if (e.InnerException != null)
                {
                    Console.WriteLine("Inner Exception: {0}", e.InnerException.Message);
                }
            }


            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #4
0
        static void Main()
        {
            Console.WriteLine("Username authentication required.");
            Console.WriteLine(" Please enter a valid domain email address:");
            string username = Console.ReadLine();

            Console.WriteLine("   Enter password:"******"";
            ConsoleKeyInfo info     = Console.ReadKey(true);

            while (info.Key != ConsoleKey.Enter)
            {
                if (info.Key != ConsoleKey.Backspace)
                {
                    password += info.KeyChar;
                    info      = Console.ReadKey(true);
                }
                else if (info.Key == ConsoleKey.Backspace)
                {
                    if (password != "")
                    {
                        password = password.Substring(0, password.Length - 1);
                    }
                    info = Console.ReadKey(true);
                }
            }

            for (int i = 0; i < password.Length; i++)
            {
                Console.Write("*");
            }

            Console.WriteLine();

            // Create a client with given client endpoint configuration
            CalculatorClient client = new CalculatorClient();

            client.ClientCredentials.UserName.UserName = username;
            client.ClientCredentials.UserName.Password = password;

            /*
             * Setting the CertificateValidationMode to PeerOrChainTrust means that if the certificate
             * is in the Trusted People store, then it will be trusted without performing a
             * validation of the certificate's issuer chain. This setting is used here for convenience so that the
             * sample can be run without having to have certificates issued by a certificate authority (CA).
             * This setting is less secure than the default, ChainTrust. The security implications of this
             * setting should be carefully considered before using PeerOrChainTrust in production code.
             */
            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);

            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #5
0
        static void Main()
        {
            // Create a wcfClient with Username endpoint configuration
            CalculatorClient wcfClient = new CalculatorClient("Username");

            try
            {
                wcfClient.ClientCredentials.UserName.UserName = "******";
                wcfClient.ClientCredentials.UserName.Password = "******";

                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = proxy.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = proxy.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = proxy.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = proxy.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

                wcfClient.Close();
            }
            catch (TimeoutException timeProblem)
            {
                Console.WriteLine("The service operation timed out. " + timeProblem.Message);
                Console.ReadLine();
                wcfClient.Abort();
            }
            catch (CommunicationException commProblem)
            {
                Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
                Console.ReadLine();
                wcfClient.Abort();
            }

            // Create a wcfClient with Certificate endpoint configuration
            CalculatorClient eptwcfClient = new CalculatorClient("Certificate");

            try
            {
                // <Snippet00>
                ChannelFactory <ISimpleChannel> cf =
                    new ChannelFactory <ISimpleChannel>();
                cf.Credentials.ClientCertificate.SetCertificate(
                    StoreLocation.CurrentUser, StoreName.My,
                    X509FindType.FindByThumbprint,
                    "37 28 05 09 22 81 07 08 a0 cd 2a af dd c3 83 cd c3 3b 8f 9d");
                cf.Credentials.ServiceCertificate.SetDefaultCertificate(
                    StoreLocation.CurrentUser,
                    StoreName.TrustedPeople,
                    X509FindType.FindByThumbprint,
                    "33 93 68 cc 7c 75 80 24 a2 80 9f 45 8c 81 fa 92 ad 5b 04 39");
                cf.Credentials.ServiceCertificate.Authentication.CertificateValidationMode
                    = X509CertificateValidationMode.PeerOrChainTrust;
                // </Snippet00>

                eptwcfClient.ClientCredentials.ClientCertificate.SetCertificate
                    (StoreLocation.CurrentUser,
                    StoreName.TrustedPeople,
                    X509FindType.FindBySubjectName, "test1");

                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = proxy.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = proxy.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = proxy.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = proxy.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
                eptwcfClient.Close();
            }
            catch (TimeoutException timeProblem)
            {
                Console.WriteLine("The service operation timed out. " + timeProblem.Message);
                Console.ReadLine();
                eptwcfClient.Abort();
            }
            catch (CommunicationException commProblem)
            {
                Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
                Console.ReadLine();
                eptwcfClient.Abort();
            }

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #6
0
        static void Main()
        {
            // Create a client using either wsat or oletx endpoint configurations
            CalculatorClient client = new CalculatorClient("WSAtomicTransaction_endpoint");

            // CalculatorClient client = new CalculatorClient("OleTransactions_endpoint");

            // Start a transaction scope
            using (TransactionScope tx =
                       new TransactionScope(TransactionScopeOption.RequiresNew))
            {
                Console.WriteLine("Starting transaction");

                // Call the Add service operation
                //  - generatedClient will flow the required active transaction
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = client.Add(value1, value2);
                Console.WriteLine("  Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation
                //  - generatedClient will flow the allowed active transaction
                value1 = 145.00D;
                value2 = 76.54D;
                result = client.Subtract(value1, value2);
                Console.WriteLine("  Subtract({0},{1}) = {2}", value1, value2, result);

                // Start a transaction scope that suppresses the current transaction
                using (TransactionScope txSuppress =
                           new TransactionScope(TransactionScopeOption.Suppress))
                {
                    // Call the Subtract service operation
                    //  - the active transaction is suppressed from the generatedClient
                    //    and no transaction will flow
                    value1 = 21.05D;
                    value2 = 42.16D;
                    result = client.Subtract(value1, value2);
                    Console.WriteLine("  Subtract({0},{1}) = {2}", value1, value2, result);

                    // Complete the suppressed scope
                    txSuppress.Complete();
                }

                // Call the Multiply service operation
                // - generatedClient will not flow the active transaction
                value1 = 9.00D;
                value2 = 81.25D;
                result = client.Multiply(value1, value2);
                Console.WriteLine("  Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                // - generatedClient will not flow the active transaction
                value1 = 22.00D;
                value2 = 7.00D;
                result = client.Divide(value1, value2);
                Console.WriteLine("  Divide({0},{1}) = {2}", value1, value2, result);

                // Complete the transaction scope
                Console.WriteLine("  Completing transaction");
                tx.Complete();
            }

            Console.WriteLine("Transaction committed");

            // Closing the client gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #7
0
        static void Main()
        {
            Console.WriteLine("Username authentication required.");
            Console.WriteLine("Provide a valid machine or domain account. [domain\\user]");
            Console.WriteLine("   Enter username:"******"   Enter password:"******"*");
            }

            Console.WriteLine();

            // Create a client
            CalculatorClient client = new CalculatorClient();

            // Configure client with valid machine or domain account (username,password)
            client.ClientCredentials.UserName.UserName = username;
            client.ClientCredentials.UserName.Password = password.ToString();

            // Call GetCallerIdentity service operation
            Console.WriteLine(client.GetCallerIdentity());

            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);

            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #8
0
        static void Main()
        {
            Console.WriteLine("Username authentication required.");
            Console.WriteLine("Provide a valid machine or domain account. [domain\\user]");
            Console.WriteLine("   Enter username:"******"   Enter password:"******"*");
            }

            Console.WriteLine();

            // WARNING: This code is only needed for test certificates such as those created by makecert. It is
            // not recommended for production code.
            PermissiveCertificatePolicy.Enact("CN=ServiceModelSamples-HTTPS-Server");

            // Create a client with given client endpoint configuration
            CalculatorClient client = new CalculatorClient();

            // Setup the UserName credential
            client.ClientCredentials.UserName.UserName = username;
            client.ClientCredentials.UserName.Password = password.ToString();

            // Call the GetCallerIdentity service operation
            Console.WriteLine(client.GetCallerIdentity());

            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);

            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);


            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Beispiel #9
0
        static void Main()
        {
            // Create a client with Username endpoint configuration
            CalculatorClient client1 = new CalculatorClient("Username");

            client1.ClientCredentials.UserName.UserName = "******";
            client1.ClientCredentials.UserName.Password = "******";

            try
            {
                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = client1.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = client1.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = client1.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = client1.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Call failed : {0}", e.Message);
            }

            client1.Close();

            // Create a client with Certificate endpoint configuration
            CalculatorClient client2 = new CalculatorClient("Certificate");

            client2.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "test1");

            try
            {
                // Call the Add service operation.
                double value1 = 100.00D;
                double value2 = 15.99D;
                double result = client2.Add(value1, value2);
                Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

                // Call the Subtract service operation.
                value1 = 145.00D;
                value2 = 76.54D;
                result = client2.Subtract(value1, value2);
                Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

                // Call the Multiply service operation.
                value1 = 9.00D;
                value2 = 81.25D;
                result = client2.Multiply(value1, value2);
                Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

                // Call the Divide service operation.
                value1 = 22.00D;
                value2 = 7.00D;
                result = client2.Divide(value1, value2);
                Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Call failed : {0}", e.Message);
            }

            client2.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }