private async void btnStartProcessing_Click(object sender, EventArgs e) { HelloServiceClient Client = new HelloServiceClient(new System.ServiceModel.InstanceContext(this)); btnStartProcessing.Enabled = false; await Client.RunProcessingAsync(); }
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); }
public PartialViewResult GetMessage(string name) { HelloServiceClient client = new HelloServiceClient("BasicHttpBinding_IHelloService"); string message = client.GetMessage(name); return(PartialView("GetMessage", message)); }
protected void Button1_Click1(object sender, EventArgs e) { HelloServiceClient client = new HelloServiceClient("BasicHttpBinding_IHelloService"); var message = client.GetMessage(TextBox1.Text); Label1.Text = message; }
static void Main(string[] args) { var proxy = new HelloServiceClient(); string message = proxy.WelcomeMessage(); Console.WriteLine(message); }
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); } }
static GreetingService() { ServiceUrl = ConfigurationManager.AppSettings["ServiceUrl"]; if (string.IsNullOrWhiteSpace(ServiceUrl)) throw new ConfigurationErrorsException("Missing 'ServiceUrl' setting!"); helloServiceClient = HelloServiceClient.GetInstance(ServiceUrl); }
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(); }
static void Main(string[] args) { HelloServiceClient client = new HelloServiceClient(); string str = client.sayHello("å¼ ä¸‰"); Console.WriteLine(str); Console.Read(); }
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; }
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); }
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; }
/// <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; }
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(); }
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; } }
public HelloServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(HelloServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { }
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); }
public HomeController() { helloServiceClient = new HelloServiceClient("BasicHttpBinding_IHelloService"); }
static void Main(string[] args) { HelloServiceClient client = new HelloServiceClient(); Console.WriteLine(client.HelloWorld("WCF")); }
private void buttonCallServiceTCP_Click(object sender, EventArgs e) { HelloServiceClient client = new HelloServiceClient("NetTcpBinding_IHelloService1"); MessageBox.Show(client.GetMessage("World!")); }
private void buttonGetSignedEncryptedMessage_Click(object sender, EventArgs e) { HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService"); MessageBox.Show(client.GetSignedAndEncryptedMessage()); }
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(); }
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(); }
private void button1_Click(object sender, EventArgs e) { HelloServiceRef.HelloServiceClient client = new HelloServiceClient("NetTcpBinding_IHelloService"); label1.Text = client.GetMessage(textBox1.Text); }
private void button1_Click(object sender, EventArgs e) { var client = new HelloServiceClient("NetTcpBinding_IHelloService"); NameLabel.Text = client.GetMessage(NameTextBox.Text); }
public Form1() { InitializeComponent(); client = new HelloServiceClient(); }
private void buttonGetMessage_Click(object sender, EventArgs e) { HelloServiceClient client = new HelloServiceClient("WSHttpBinding_IHelloService"); MessageBox.Show(client.GetMessageWithoutAnyProtection()); }
static void Main(string[] args) { IHelloService svc = new HelloServiceClient(); Console.WriteLine(svc.SayHello("luis")); Console.ReadLine(); }
private void btnHello_Click(object sender, EventArgs e) { HelloServiceClient client = new HelloServiceClient(); lblMessage.Text = client.Hello(txtName.Text); }
public void Connect() { _channel = new Channel("localhost:1234", ChannelCredentials.Insecure); _client = new HelloServiceClient(_channel); }