Ejemplo n.º 1
0
    public static void Main()
    {
        // Picks up configuration from the config file.
        MessagingHelloClient wcfClient = new MessagingHelloClient();

        try
        {
            // Making calls.
            Console.WriteLine("Enter the greeting to send: ");
            string greeting = Console.ReadLine();
            HelloResponseMessage response = wcfClient.Hello(new HelloGreetingMessage(greeting));
            Console.WriteLine("The service responded: " + response.ResponseToGreeting);
            Console.WriteLine("and " + response.OutOfBandData);

            Console.WriteLine("Press ENTER to exit:");
            Console.ReadLine();

            // Done with service.
            wcfClient.Close();
            Console.WriteLine("Done!");
        }
        catch (TimeoutException timeProblem)
        {
            Console.WriteLine("The service operation timed out. " + timeProblem.Message);
            Console.Read();
            wcfClient.Abort();
        }
        catch (CommunicationException commProblem)
        {
            Console.WriteLine("There was a communication problem. " + commProblem.Message);
            Console.Read();
            wcfClient.Abort();
        }
    }
        public void Handle(HelloCommandMessage message)
        {
            var response = new HelloResponseMessage()
            {
                Message = $"Hello {message.Name}"
            };

            _bus.Reply(response);
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string s = string.Empty;

            ServiceReference1.IMessageHello sm          = new MessageHelloClient();
            HelloGreetingMessage            greetingMsg = new HelloGreetingMessage("Vincent Wang");
            HelloResponseMessage            response    = sm.Hello(greetingMsg);



            MessageBox.Show(response.ResponseToGreeting);
            MessageBox.Show(response.OutOfBandData);
        }
 private void ReceiveResolverName(HelloResponseMessage message)
 {
     _resolverName = message.ResolverName;
 }