Exemplo n.º 1
0
        private static void PingProxyTest()
        {
            string endpointConfigurationName = "BasicHttpBinding_IHelloService";

            HelloServiceProxy client = new HelloServiceProxy(endpointConfigurationName);
            string            result = client.Ping("Hello");

            Console.WriteLine(result);

            client.Send("World");
        }
Exemplo n.º 2
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}");
        }
Exemplo n.º 3
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}");
        }