private static void PingProxyTest() { string endpointConfigurationName = "BasicHttpBinding_IHelloService"; HelloServiceProxy client = new HelloServiceProxy(endpointConfigurationName); string result = client.Ping("Hello"); Console.WriteLine(result); client.Send("World"); }
// 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}"); }
// 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}"); }