Beispiel #1
0
        // Konfiguracja z pliku
        private static void ProxyClassTest()
        {
            string endpointConfigurationName = "BasicHttpBinding_IHelloService";

            HelloServiceProxy client = new HelloServiceProxy(endpointConfigurationName);

            client.Send("Hello World!");

            string response = client.Ping("Hello World!");

            Console.WriteLine(response);

            Customer customer = client.Get(1);

            Console.WriteLine($"{customer.FirstName} {customer.LastName}");
        }
Beispiel #2
0
        // Konfiguracja z kodu
        private static void ProxyClassCodeTest()
        {
            Uri uri = new Uri(ConfigurationManager.AppSettings["HelloServiceAddress"]);

            BasicHttpBinding binding  = new BasicHttpBinding();
            EndpointAddress  endpoint = new EndpointAddress(uri);

            HelloServiceProxy client = new HelloServiceProxy(binding, endpoint);

            client.Send("Hello World!");

            string response = client.Ping("Hello World!");

            Console.WriteLine(response);

            Customer customer = client.Get(1);

            Console.WriteLine($"{customer.FirstName} {customer.LastName}");
        }