Example #1
0
        private async void btnStartProcessing_Click(object sender, EventArgs e)
        {
            HelloServiceClient Client = new HelloServiceClient(new System.ServiceModel.InstanceContext(this));

            btnStartProcessing.Enabled = false;
            await Client.RunProcessingAsync();
        }
Example #2
0
        static void Main(string[] args)
        {
            HelloServiceClient p = new HelloServiceClient();

            Console.WriteLine("Hello World says: " + p.sayHi());

            IssuesContractClient wcfIssues = new IssuesContractClient();

            // verify running
            Console.WriteLine("This system name is " + wcfIssues.Ping() + ".");

            GetIssuesRequest rqGetIssues = new GetIssuesRequest();
            // Get Sync
            GetIssuesResponse rsGetIssues = wcfIssues.GetIssues(rqGetIssues);

            Console.WriteLine(rsGetIssues.IssuesCD.Issues.Rows.Count + " row(s) read from IssuesServiceWCF.");
            // Get Async
            IAsyncResult ar = wcfIssues.BeginGetIssues(rqGetIssues, wcf_ClientGetIssuesCompleted, wcfIssues);

            SettingsContractClient wcfSettings = new SettingsContractClient();

            // verify running
            Console.WriteLine("This system name is " + wcfSettings.Ping() + ".");

            GetUserSettingsRequest rqGetUserSettings = new GetUserSettingsRequest();

            rqGetUserSettings.UserName = "******";
            //// Get Sync
            GetUserSettingsResponse rsGetUserSettings = wcfSettings.GetUserSettings(rqGetUserSettings);
        }
Example #3
0
        public PartialViewResult GetMessage(string name)
        {
            HelloServiceClient client  = new HelloServiceClient("BasicHttpBinding_IHelloService");
            string             message = client.GetMessage(name);

            return(PartialView("GetMessage", message));
        }
Example #4
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            HelloServiceClient client = new HelloServiceClient("BasicHttpBinding_IHelloService");
            var message = client.GetMessage(TextBox1.Text);

            Label1.Text = message;
        }
Example #5
0
        static void Main(string[] args)
        {
            var    proxy   = new HelloServiceClient();
            string message = proxy.WelcomeMessage();

            Console.WriteLine(message);
        }
Example #6
0
        static void Main(string[] args)
        {
            var binding  = new BasicHttpBinding();
            var endpoint = new EndpointAddress("http://localhost:8000/SEP");

            try
            {
                var client = new HelloServiceClient(binding, endpoint);

                while (true)
                {
                    Console.Clear();
                    ShowHelp();

                    var name = Console.ReadLine();
                    if (string.IsNullOrEmpty(name))
                    {
                        break;
                    }

                    var ret = client.SayHello(name);

                    Console.WriteLine(ret);
                    Console.WriteLine("Hit <ENTER> to continue");
                    Console.ReadLine();
                }

                Console.ReadLine();
                client.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #7
0
        static GreetingService()
        {
            ServiceUrl = ConfigurationManager.AppSettings["ServiceUrl"];
            if (string.IsNullOrWhiteSpace(ServiceUrl))
                throw new ConfigurationErrorsException("Missing 'ServiceUrl' setting!");

            helloServiceClient = HelloServiceClient.GetInstance(ServiceUrl);
        }
Example #8
0
        static void Main(string[] args)
        {
            Proxy_Hello.HelloServiceClient proxy = new HelloServiceClient("BasicHttpBinding_IHelloService");
            string str = proxy.HelloMessage();

            Console.WriteLine(" Got Message from HelloService:" + str);
            Console.ReadLine();
        }
Example #9
0
        static void Main(string[] args)
        {
            HelloServiceClient client = new HelloServiceClient();
            string             str    = client.sayHello("张三");

            Console.WriteLine(str);
            Console.Read();
        }
Example #10
0
        private async void btnInit_Click(object sender, EventArgs e)
        {
            HelloServiceClient Client = new HelloServiceClient(new System.ServiceModel.InstanceContext(this));
            await Client.StartTimeProcessingAsync();

            btnInit.Enabled            = false;
            btnGetResponse.Enabled     = true;
            btnStartProcessing.Enabled = true;
        }
Example #11
0
        private void btnMessage_Click(object sender, EventArgs e)
        {
            //HelloServiceClient client = new HelloServiceClient("NetTcpBinding_IHelloService"); // Invoke Hello Service via host APP
            //HelloServiceIIS.HelloServiceClient client = new HelloServiceIIS.HelloServiceClient("BasicHttpBinding_IHelloServiceIIS");// Invoke Hello Service via host IIS. IIS dont support TCP
            //HelloServiceIIS.HelloServiceClient client = new HelloServiceIIS.HelloServiceClient("NetTcpBinding_IHelloServiceIIS");// WAS hosting
            HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService");

            lblGetMessageResult.Text = client.GetMessage(tbName.Text);
        }
Example #12
0
        private async void btnGetResponse_Click(object sender, EventArgs e)
        {
            HelloServiceClient Client = new HelloServiceClient(new System.ServiceModel.InstanceContext(this));

            btnGetResponse.Enabled = false;
            lblResponse.Text       = await Client.GetResponseAsync();

            btnGetResponse.Enabled = true;
        }
Example #13
0
 /// <summary>
 /// Following method initiates the client to talk to service on the 
 /// end points address specified in the app.config. We picked one of the end points.
 /// Any end point can be chosen
 /// </summary>
 /// <param name="args"></param>
 static void Main(string[] args)
 {
     HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService");
     HelloData userName = new HelloData();
     userName.Fname = "Anshul";
     userName.Lname = "Pandey";
     Console.WriteLine("Client Send the message "+ userName.Fname + " "+ userName.Lname);
     Console.WriteLine("Client received Following Message from Service" + client.HelloWorld(userName));
     Console.ReadLine();
 }
 public Client(bool useHttps)
 {
     _client =
         new HelloServiceClient(useHttps
             ? HelloServiceClient.EndpointConfiguration.BasicHttpBinding_IHelloService
             : HelloServiceClient.EndpointConfiguration.BasicHttpBinding_IHelloService1);
     _client.OpenCompleted     += _client_AsyncCompleted;
     _client.CloseCompleted    += _client_AsyncCompleted;
     _client.SayHelloCompleted += _client_SayHelloCompleted;
 }
Example #15
0
        static void Main(string[] args)
        {
            HelloServiceClient wcfClient = new HelloServiceClient();
            CompositeType      obj       = new CompositeType();

            obj.BoolValue   = true;
            obj.StringValue = "Hello WCF TCP client!";
            CompositeType objret = wcfClient.GetDataUsingDataContract(obj);

            Console.WriteLine("GetDataUsingDataContract returns: " + objret.StringValue);
            Console.ReadLine();
            wcfClient.Close();
        }
Example #16
0
        private void btnHello_Click(object sender, EventArgs e)
        {
            try
            {
                if (client.State == System.ServiceModel.CommunicationState.Faulted)
                {
                    client = new HelloServiceClient();
                }

                lblMessage.Text = client.Hello(txtName.Text);
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Example #17
0
 public HelloServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(HelloServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
 }
Example #18
0
 public HelloServiceClient(EndpointConfiguration endpointConfiguration) :
     base(HelloServiceClient.GetBindingForEndpoint(endpointConfiguration), HelloServiceClient.GetEndpointAddress(endpointConfiguration))
 {
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     HelloService.HelloServiceClient client = new HelloServiceClient("BasicHttpBinding_IHelloService");
     Label1.Text = client.GetMessage(TextBox1.Text);
 }
Example #20
0
 public HomeController()
 {
     helloServiceClient = new HelloServiceClient("BasicHttpBinding_IHelloService");
 }
Example #21
0
        static void Main(string[] args)
        {
            HelloServiceClient client = new HelloServiceClient();

            Console.WriteLine(client.HelloWorld("WCF"));
        }
Example #22
0
        private void buttonCallServiceTCP_Click(object sender, EventArgs e)
        {
            HelloServiceClient client = new HelloServiceClient("NetTcpBinding_IHelloService1");

            MessageBox.Show(client.GetMessage("World!"));
        }
Example #23
0
        private void buttonGetSignedEncryptedMessage_Click(object sender, EventArgs e)
        {
            HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService");

            MessageBox.Show(client.GetSignedAndEncryptedMessage());
        }
Example #24
0
        static void Main()
        {
            Console.WriteLine("*** Call 'Hello' with svcutil-generated client");
            HelloServiceClient helloClient = new HelloServiceClient();

            Greeting greeting = new Greeting();
            greeting.text = "Hello Server!";
            GreetingResponse response = helloClient.Hello(greeting);
            Console.WriteLine(response.text);
            helloClient.Close();

            try
            {
                Console.WriteLine("*** Call 'Hello' with generic client, no client behavior");
                GenericClient client = new GenericClient();

                Console.WriteLine("--- Sending valid client request:");
                GenericCallValid(client, helloAction);
                Console.WriteLine("--- Sending invalid client request:");
                GenericCallInvalid(client, helloAction);
                client.Close();

            }
            catch (Exception e)
            {
                DumpException(e);
            }

            try
            {
                Console.WriteLine("*** Call 'Hello' with generic client, with client behavior");
                GenericClient client = new GenericClient();

                // Configure client programmatically, adding behavior
                XmlSchema schema = XmlSchema.Read(new StreamReader("messages.xsd"), null);
                XmlSchemaSet schemaSet = new XmlSchemaSet();
                schemaSet.Add(schema);
                client.Endpoint.Behaviors.Add(new SchemaValidationBehavior(schemaSet, true, true));

                Console.WriteLine("--- Sending valid client request:");
                GenericCallValid(client, helloAction);
                Console.WriteLine("--- Sending invalid client request:");
                GenericCallInvalid(client, helloAction);

                client.Close();
            }
            catch (Exception e)
            {
                DumpException(e);
            }

            Console.WriteLine("*** Call 'HelloToo' with generic client, no client behavior");
            try
            {
                GenericClient client = new GenericClient();

                Console.WriteLine("--- Sending valid client request, malformed service reply:");
                GenericCallValid(client, helloTooAction);
                client.Close();

            }
            catch (Exception e)
            {
                DumpException(e);
            }

            Console.WriteLine("*** Call 'HelloToo' with generic client, with client behavior, no service behavior");
            try
            {
                GenericClient client = new GenericClient();

                XmlSchema schema = XmlSchema.Read(new StreamReader("messages.xsd"), null);
                XmlSchemaSet schemaSet = new XmlSchemaSet();
                schemaSet.Add(schema);

                client.Endpoint.Address = new EndpointAddress(client.Endpoint.Address.Uri.ToString() + "/novalidation");
                client.Endpoint.Behaviors.Add(new SchemaValidationBehavior(schemaSet, true, true));

                Console.WriteLine("--- Sending valid client request, malformed service reply:");
                GenericCallValid(client, helloTooAction);
                client.Close();
            }
            catch (Exception e)
            {
                DumpException(e);
            }

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Example #25
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("localhost:9000", ChannelCredentials.Insecure);

            // Single message
            var    client = new HelloServiceClient(channel);
            String user   = "******";

            var reply = client.SayHello(new Common.Messages.HelloNameRequest {
                Name = user
            });

            Console.WriteLine("Basic hello world!");
            Console.WriteLine("Greeting: " + reply.Message);
            Console.WriteLine("*****************************************************************");

            // message with type
            const int years     = -7;
            long      dateValue = DateTime.Today.AddYears(years).Date.Ticks;
            var       response2 = client.SayHelloWithDetails(new Common.Messages.HelloRequest
            {
                Name = user, Age = Math.Abs(years), IsHappy = true, DateOfBirthLong = dateValue
            });

            Console.WriteLine("Hello with type.");
            Console.WriteLine("Greeting: " + response2.Message);
            Console.WriteLine("*****************************************************************");

            // List of messages
            var request3 = new Common.Messages.HelloListRequest();

            request3.Names.Add("rahman");
            request3.Names.Add("maria");
            request3.Names.Add("hosha");
            request3.Names.Add("roya");
            request3.Names.Add("cyrus");
            var response3 = client.SayHelloList(request3);

            Console.WriteLine("Hello list.");
            foreach (var item in response3.Names)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("*****************************************************************");

            // Stream list
            var listOfNames = new List <string>()
            {
                "rahman",
                "maria",
                "hosha",
                "roya",
                "cyrus"
            };

            Console.WriteLine("Hello stream.");
            foreach (var name in listOfNames)
            {
                var streamRequest = new Common.Messages.HelloStreamListRequest();
                streamRequest.Names.Add(name);
                var streamResponse = client.SayHelloListStream(streamRequest);

                foreach (var item in streamResponse.Names)
                {
                    Console.WriteLine(item);
                }

                Thread.Sleep(1000); // simulating a stream!!!
            }
            Console.WriteLine("*****************************************************************");

            channel.ShutdownAsync().Wait();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Example #26
0
 private void button1_Click(object sender, EventArgs e)
 {
     HelloServiceRef.HelloServiceClient client = new HelloServiceClient("NetTcpBinding_IHelloService");
     label1.Text = client.GetMessage(textBox1.Text);
 }
Example #27
0
 private void button1_Click(object sender, EventArgs e)
 {
     var client = new HelloServiceClient("NetTcpBinding_IHelloService");
     NameLabel.Text = client.GetMessage(NameTextBox.Text);
 }
Example #28
0
 public Form1()
 {
     InitializeComponent();
     client = new HelloServiceClient();
 }
Example #29
0
        private void buttonGetMessage_Click(object sender, EventArgs e)
        {
            HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService");

            MessageBox.Show(client.GetMessageWithoutAnyProtection());
        }
Example #30
0
 static void Main(string[] args)
 {
     IHelloService svc = new HelloServiceClient();
     Console.WriteLine(svc.SayHello("luis"));
     Console.ReadLine();
 }
Example #31
0
        private void btnHello_Click(object sender, EventArgs e)
        {
            HelloServiceClient client = new HelloServiceClient();

            lblMessage.Text = client.Hello(txtName.Text);
        }
Example #32
0
 public void Connect()
 {
     _channel = new Channel("localhost:1234", ChannelCredentials.Insecure);
     _client  = new HelloServiceClient(_channel);
 }