public async Task test([FromQuery] string value) { Hello_PortTypeClient client = new Hello_PortTypeClient(); Console.WriteLine($"Got value as {value}"); sayHelloResponse sayHelloResponse = await client.sayHelloAsync(value); Console.WriteLine($"Greeting recieved is {sayHelloResponse.greeting}"); }
public HelloService(IHttpMessageHandlerFactory factory, ILogger <HelloService> logger, IOptionsMonitor <HelloServiceOptions> options) { _logger = logger; _client = new Hello_PortTypeClient(); _client.Endpoint.EndpointBehaviors.Add(new HttpMessageHandlerBehavior(factory, ServiceName)); _client.Endpoint.Address = new EndpointAddress(options.CurrentValue.EndpointAddress); _client.Endpoint.Binding.CloseTimeout = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds); _client.Endpoint.Binding.OpenTimeout = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds); _client.Endpoint.Binding.ReceiveTimeout = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds); _client.Endpoint.Binding.SendTimeout = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds); }
/// <summary> /// The send hello method. /// </summary> /// <param name="firstName"> /// The first name. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public string SendHello(string firstName) { // Client Proxy var client = new Hello_PortTypeClient("Hello_Binding"); // Add custom behavior var behavior = new PasswordDigestBehavior("Username", "Password"); client.Endpoint.Behaviors.Add(behavior); // Say hello return(client.sayHello(null, firstName)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async(context) => { var client = new Hello_PortTypeClient(); var response = await client.sayHelloAsync("World"); await context.Response.WriteAsync(response.greeting); }); }
public Hello_PortTypeClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(Hello_PortTypeClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public Hello_PortTypeClient(EndpointConfiguration endpointConfiguration) : base(Hello_PortTypeClient.GetBindingForEndpoint(endpointConfiguration), Hello_PortTypeClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public Hello_PortTypeClient() : base(Hello_PortTypeClient.GetDefaultBinding(), Hello_PortTypeClient.GetDefaultEndpointAddress()) { this.Endpoint.Name = EndpointConfiguration.Hello_Port.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() { return(Hello_PortTypeClient.GetEndpointAddress(EndpointConfiguration.Hello_Port)); }
private static System.ServiceModel.Channels.Binding GetDefaultBinding() { return(Hello_PortTypeClient.GetBindingForEndpoint(EndpointConfiguration.Hello_Port)); }