public void Execute() { try { // Instanciate the Inspector BFMInspector inspector = new BFMInspector(); // Select the URL you'll be sending the request. I've passed this as a parameter in the constructor EndpointAddress url = new EndpointAddress(new Uri(endpoint)); // Create a binding, with a couple of characteristics, because of the size of the response Binding binding = new BasicHttpsBinding() { MaxReceivedMessageSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue }; // Create the executable the BargainFinderMaxPortTypeClient variable, which will allow me to call the service BargainFinderMaxPortTypeClient execute = new BargainFinderMaxPortTypeClient(binding, url); // Add the middleware. Here's where ApplyClientBehavior is called behind the scene and adds itself execute.Endpoint.EndpointBehaviors.Add(inspector); // Call BFM and successfully get the response as an OTA_AirLowFareSearchRS object response = execute.BargainFinderMaxRQ(ref service.MessageHeader, ref service.Security, request); Console.WriteLine(response); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void AddCCWServiceClient(this IServiceCollection services, IConfiguration config) { services.AddSingleton <CVSECommonClient>(provider => { var username = config.GetValue <string>("CCW_USER_ID"); var password = config.GetValue <string>("CCW_PASSWORD"); var url = config.GetValue <string>("CCW_ENDPOINT_URL"); var appId = config.GetValue <string>("CCW_APP_ID"); var batchUser = config.GetValue <string>("CCW_USER_ID"); var batchAppId = config.GetValue <string>("CCW_BATCH_APP_ID"); var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; var client = new CVSECommonClient(EndpointConfiguration.CVSECommon); client.ClientCredentials.UserName.UserName = username; client.ClientCredentials.UserName.Password = password; client.Endpoint.Binding = binding; client.Endpoint.Address = new EndpointAddress(url); client.BatchAppId = batchAppId; client.AppId = appId; client.BatchUser = batchUser; return(client); }); services.AddSingleton <ICCWService, CCWService>(); }
public static BasicHttpsBinding GetBufferedModeHttpsBinding() { var binding = new BasicHttpsBinding(); ApplyDebugTimeouts(binding); return(binding); }
private EsocialServiceClient DefineBaseClient(string Base) { if (Base == "True") { var urlServicoEnvio = @"https://apiesocial2.vertech-it.com.br/vch-esocial/consultaintegra?wsdl"; var address = new EndpointAddress(urlServicoEnvio); var binding = new BasicHttpsBinding(); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; var wsClient = new EsocialServiceClient(binding, address); wsClient.ClientCredentials.UserName.UserName = Convert.ToString(this.Grupo); wsClient.ClientCredentials.UserName.Password = this.Token; wsClient.Endpoint.Behaviors.Add(new CustomEndpointCallBehavior(Convert.ToString(this.Grupo), this.Token)); return(wsClient); } var wsClientP = new EsocialServiceClient(); wsClientP.ClientCredentials.UserName.UserName = Convert.ToString(this.Grupo); wsClientP.ClientCredentials.UserName.Password = this.Token; wsClientP.Endpoint.Behaviors.Add(new CustomEndpointCallBehavior(Convert.ToString(this.Grupo), this.Token)); return(wsClientP); }
public static void AddBceidSoapClient(this IServiceCollection services, IConfiguration config) { services.AddScoped <BCeIDServiceSoapClient>(provider => { var username = config.GetValue <string>("BCEID_USER"); var password = config.GetValue <string>("BCEID_PASSWORD"); var url = config.GetValue <string>("BCEID_URL"); var osid = config.GetValue <string>("BCEID_OSID"); var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; var client = new BCeIDServiceSoapClient(EndpointConfiguration.BCeIDServiceSoap12); client.ClientCredentials.UserName.UserName = username; client.ClientCredentials.UserName.Password = password; client.Endpoint.Binding = binding; client.Endpoint.Address = new EndpointAddress(url); client.Osid = osid; return(client); }); services.AddScoped <IBceidApi, BceidApi>(); }
private Binding SetBasicHttpsBinding(BasicHttpsBinding binding) { binding.MaxReceivedMessageSize = 2147483647; binding.MaxBufferSize = 2147483647; return(binding); }
private static CoreServiceClient CreateBasicHttpsClient(string hostname) { var basicHttpBinding = new BasicHttpsBinding { MaxReceivedMessageSize = MaxMessageSize, ReaderQuotas = new XmlDictionaryReaderQuotas { MaxStringContentLength = MaxMessageSize, MaxArrayLength = MaxMessageSize }, Security = new BasicHttpsSecurity { Mode = BasicHttpsSecurityMode.Transport, Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.Basic } } }; hostname = string.Format("{0}{1}{2}", hostname.StartsWith("https") ? "" : "https://", hostname, hostname.EndsWith("/") ? "" : "/"); var remoteAddress = new EndpointAddress(string.Format(ServiceUrl, hostname)); return(new CoreServiceClient(basicHttpBinding, remoteAddress));; }
static void Main(string[] args) { var config = SetUp(); var baseUri = config.GetSection("TalentManagerRemotingService:BaseUri").Value; var subscriptionkey = config.GetSection("TalentManagerRemotingService:SubscriptionKey").Value; var authenticationToken = config.GetSection("TalentRecruiterRemotingService:AuthenticationToken").Value; string APISubscriptionKeyQuery = $"subscription-key={subscriptionkey}"; var binding = new BasicHttpsBinding(); var endpoint = new System.ServiceModel.EndpointAddress(baseUri + "?" + APISubscriptionKeyQuery); var talentMangerRemotingServiceClient = new TalentMangerRemotingServiceClient(binding, endpoint); //Example of how to fill out the request //Delete and replace these details with your company data var query = new GetBatchSyncEmployeesStatusRqt() { AuthenticationToken = authenticationToken, CustomerId = 1886, ReferenceToken = "20191017-4", InitialReferenceToken = "20191017-4" }; //End of Example var v = talentMangerRemotingServiceClient.GetBatchSyncEmployeesStatusAsync(query); v.Wait(); Console.WriteLine(v.Result.TransactionStatus.StatusDescription); Console.Read(); }
public void Ping() { var binding = new BasicHttpsBinding(); binding.Name = "SystemPingPort"; binding.CloseTimeout = TimeSpan.FromMinutes(1); binding.OpenTimeout = TimeSpan.FromMinutes(1); binding.ReceiveTimeout = TimeSpan.FromMinutes(10); binding.SendTimeout = TimeSpan.FromMinutes(1); binding.Security.Mode = BasicHttpsSecurityMode.Transport; //binding.ProxyAddress = new Uri("http://localhost:8888"); //BasicHttpSecurityMode.Transport; // binding.Security.Transport. var endpoint = new EndpointAddress("https://apac.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/SystemService"); SystemPingPortTypeClient client = new SystemPingPortTypeClient(binding, endpoint); //client.ClientCredentials.UserName.UserName = "******"; //client.ClientCredentials.UserName.Password = "******"; var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); PingReq req = new PingReq { TraceId = "Test", Payload = "Ping test", }; var result = client.serviceAsync(req).Result; }
private void OpenHttpsConnection(NetworkCredential credentials, EndpointAddress endpointAddress) { var binding = new BasicHttpsBinding() { MaxBufferSize = int.MaxValue, MaxBufferPoolSize = int.MaxValue, MaxReceivedMessageSize = int.MaxValue, ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas() { MaxStringContentLength = int.MaxValue, MaxArrayLength = int.MaxValue, }, Security = new BasicHttpsSecurity() { Mode = BasicHttpsSecurityMode.Transport, Transport = new HttpTransportSecurity() { ClientCredentialType = HttpClientCredentialType.Basic } } }; ChannelFactory <ICoreService> factory = new ChannelFactory <ICoreService>(binding, endpointAddress); var credentialBehaviour = factory.Endpoint.Behaviors.Find <System.ServiceModel.Description.ClientCredentials>(); credentialBehaviour.UserName.UserName = credentials.UserName; credentialBehaviour.UserName.Password = credentials.Password; _client = factory.CreateChannel(); _factory = factory; }
public async Task <IeCaseServiceClient> Connect() { BasicHttpsBinding myBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; myBinding.SendTimeout = new TimeSpan(0, 2, 30); myBinding.MaxReceivedMessageSize = int.MaxValue; myBinding.MaxBufferSize = int.MaxValue; myBinding.MaxBufferPoolSize = int.MaxValue; myBinding.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; EndpointAddress myEndpoint = new EndpointAddress(configuration.GetValue <string>("EPEP:Endpoint")); IeCaseServiceClient serviceClient = new IeCaseServiceClient(myBinding, myEndpoint); serviceClient.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2(configuration.GetValue <string>("EPEP:CertificatePath"), configuration.GetValue <string>("EPEP:CertificatePassword")); try { await serviceClient.OpenAsync(); return(serviceClient); } catch (Exception ex) { return(null); } }
public ChiliConnector(string url) { this.url = url; if (ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls)) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; } // Stop 417 exception ServicePointManager.Expect100Continue = false; EndpointAddress endpointAddress = new EndpointAddress(url); if (url.Contains("https")) { BasicHttpsBinding basicHttpsBinding = new BasicHttpsBinding(); basicHttpsBinding.MaxReceivedMessageSize = int.MaxValue; basicHttpsBinding.OpenTimeout = new TimeSpan(0, 20, 0); basicHttpsBinding.CloseTimeout = new TimeSpan(0, 20, 0); basicHttpsBinding.SendTimeout = new TimeSpan(0, 20, 0); basicHttpsBinding.ReceiveTimeout = new TimeSpan(0, 20, 0); soapClient = new mainSoapClient(basicHttpsBinding, endpointAddress); } else { BasicHttpBinding basicHttpBinding = new BasicHttpBinding(); basicHttpBinding.MaxReceivedMessageSize = int.MaxValue; basicHttpBinding.OpenTimeout = new TimeSpan(0, 20, 0); basicHttpBinding.CloseTimeout = new TimeSpan(0, 20, 0); basicHttpBinding.SendTimeout = new TimeSpan(0, 20, 0); basicHttpBinding.ReceiveTimeout = new TimeSpan(0, 20, 0); soapClient = new mainSoapClient(basicHttpBinding, endpointAddress); } }
public static TPortClient CreateEndpoint <TPortClient, TPortType>(string url) where TPortClient : ClientBase <TPortType>, TPortType where TPortType : class { Binding binding; EndpointAddress endpointAddress = new EndpointAddress(url); if (url.StartsWith("https:")) { binding = new BasicHttpsBinding { MaxBufferSize = Buffersize, MaxReceivedMessageSize = Buffersize, ReaderQuotas = { MaxArrayLength = int.MaxValue, MaxDepth = int.MaxValue, MaxStringContentLength = int.MaxValue }, Security = new BasicHttpsSecurity { Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.Certificate } } }; } else { binding = new BasicHttpBinding { MaxBufferSize = Buffersize, MaxReceivedMessageSize = Buffersize, ReaderQuotas = { MaxArrayLength = int.MaxValue, MaxDepth = int.MaxValue, MaxStringContentLength = int.MaxValue } }; } var client = (TPortClient)Activator.CreateInstance(typeof(TPortClient), binding, endpointAddress); client.Endpoint.Behaviors.Add(new LoggingEndpointBehavior()); return(client); }
public DeviceDriverProxy(string uri, string username, SecureString password) { Uri localUri = new Uri(uri); EndpointAddress ep = new EndpointAddress(localUri); Binding binding; if (localUri.Scheme == Uri.UriSchemeHttps) { binding = new BasicHttpsBinding { MaxReceivedMessageSize = MaxMessageSize }; } else { binding = new BasicHttpBinding { MaxReceivedMessageSize = MaxMessageSize }; } Client = new DemoDriverDevice.DeviceServiceClient(binding, ep); Client.Open(); long tickStop = DateTime.Now.Ticks + TickStopDelay; while (DateTime.Now.Ticks < tickStop && Client.State == CommunicationState.Opening) { System.Threading.Thread.Sleep(5); } if (Client.State == CommunicationState.Opening) { System.Diagnostics.Trace.WriteLine("CommunicationClient", "Did not reach OPEN state with 5 seconds"); } }
public static Binding CreateHttpsBinding() { var b = new BasicHttpsBinding(); SetupHttpsBindingSecurity(b); return(SetupBindingTimeouts(b)); }
public static void AddBceidSoapClient(this IServiceCollection services, IConfiguration config) { services.AddSingleton <BCeIDServiceSoapClient>(provider => { var username = config.GetValue <string>("ServiceAccount:User"); var password = config.GetValue <string>("ServiceAccount:Password"); var url = config.GetValue <string>("BCEID:Url"); var osid = config.GetValue <string>("BCEID:OSID"); var cacheLifeSpan = config.GetValue <int>("BCEID:CacheLifespan"); var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; var client = new BCeIDServiceSoapClient(EndpointConfiguration.BCeIDServiceSoap12); client.ClientCredentials.UserName.UserName = username; client.ClientCredentials.UserName.Password = password; client.Endpoint.Binding = binding; client.Endpoint.Address = new EndpointAddress(url); client.Osid = osid; client.CacheLifespan = cacheLifeSpan == 0 ? 60 : cacheLifeSpan; //60 minutes default return(client); }); services.AddSingleton <IBceidApi, BceidApi>(); }
public void UpdateServiceConfiguration() { if (svcClient != null && svcClient.State == CommunicationState.Opened) { svcClient.Close(); svcClient = null; } System.ServiceModel.Channels.Binding b = new BasicHttpBinding(); if (Properties.Settings.Default.ExtensionConfigured) { Uri baseUrl = new Uri(Properties.Settings.Default.BaseUrl); if (baseUrl.Scheme.Equals("http", StringComparison.InvariantCultureIgnoreCase)) { b = new BasicHttpBinding(); ((BasicHttpBinding)b).MaxReceivedMessageSize = 5 * 1024 * 1024; } if (baseUrl.Scheme.Equals("https", StringComparison.InvariantCultureIgnoreCase)) { b = new BasicHttpsBinding(); ((BasicHttpsBinding)b).MaxReceivedMessageSize = 5 * 1024 * 1024; } svcClient = new MantisConnectPortTypeClient(b, _endpointAddr); } }
private Binding GetBinding() { var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; return(binding); }
public static BasicHttpsBinding ObtenerBindingsHttps() { BasicHttpsBinding binding = new BasicHttpsBinding(); binding.CloseTimeout = new TimeSpan(0, 1, 0); //1 minutos binding.OpenTimeout = new TimeSpan(0, 1, 0); //1 minutos binding.ReceiveTimeout = new TimeSpan(0, 10, 0); //10 minutos binding.SendTimeout = new TimeSpan(0, 1, 0); //1 minutos binding.AllowCookies = false; binding.BypassProxyOnLocal = false; binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; binding.MaxBufferSize = 2147483647; binding.MaxBufferPoolSize = 2147483647; binding.MaxReceivedMessageSize = 2147483647; binding.MessageEncoding = WSMessageEncoding.Text; binding.TextEncoding = Encoding.UTF8; binding.TransferMode = TransferMode.Buffered; binding.UseDefaultWebProxy = true; binding.ReaderQuotas.MaxDepth = 32; binding.ReaderQuotas.MaxStringContentLength = 2147483647; binding.ReaderQuotas.MaxArrayLength = 2147483647; binding.ReaderQuotas.MaxBytesPerRead = 2147483647; binding.ReaderQuotas.MaxNameTableCharCount = 2147483647; return(binding); }
static void Main(string[] args) { using (var host = new ServiceHost(typeof(WcfService))) { var address = new Uri("https://localhost:9000/MyService"); var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.TransportWithMessageCredential); binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; host.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom; host.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CredentialsValidator(); // Attach a Certificate from the Certificate Store to the HTTP Binding string certThumbprint = "a5394ac183ef41da4ac99856de426087267e9f64"; host.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, certThumbprint); host.AddServiceEndpoint(typeof(IWcfService), binding, address); host.Open(); Console.WriteLine("Service started, press any key to finish execution."); Console.ReadKey(); host.Close(); } }
protected T GetProxy <T>(string endpointAddress) { BasicHttpsBinding secureBinding; BasicHttpBinding nonSecureBinding; ChannelFactory <T> myChannelFactory; // Create the binding. EndpointAddress ea = new EndpointAddress(endpointAddress); if (ambiente.FromIAM) { secureBinding = new BasicHttpsBinding(); secureBinding.Security.Mode = BasicHttpsSecurityMode.Transport; secureBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; secureBinding.SendTimeout = TimeSpan.FromMinutes(60); secureBinding.MaxReceivedMessageSize = 2147483647; myChannelFactory = new ChannelFactory <T>(secureBinding, ea); myChannelFactory.Credentials.UserName.UserName = ambiente.Username; myChannelFactory.Credentials.UserName.Password = ambiente.Password; } else { nonSecureBinding = new BasicHttpBinding(); nonSecureBinding.SendTimeout = TimeSpan.FromMinutes(60); nonSecureBinding.MaxReceivedMessageSize = 2147483647; myChannelFactory = new ChannelFactory <T>(nonSecureBinding, ea); } // Create a channel T wcfClient = myChannelFactory.CreateChannel(); return(wcfClient); }
private ITracktorService CreateServiceClient() { var uri = new Uri(Configuration["Tracktor:ServiceUrl"]); HttpBindingBase httpBinding; if (uri.Scheme == "http") { var binding = new BasicHttpBinding(); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; httpBinding = binding; } else { var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; httpBinding = binding; } var identity = new DnsEndpointIdentity(""); var address = new EndpointAddress(uri, identity, new AddressHeader[0]); var factory = new ChannelFactory <ITracktorService>(httpBinding, address); ClientCredentials loginCredentials = new ClientCredentials(); loginCredentials.UserName.UserName = "******"; loginCredentials.UserName.Password = Configuration["Tracktor:ServicePassword"]; var defaultCredentials = factory.Endpoint.EndpointBehaviors.OfType <ClientCredentials>().First(); factory.Endpoint.EndpointBehaviors.Remove(defaultCredentials); factory.Endpoint.EndpointBehaviors.Add(loginCredentials); return(factory.CreateChannel()); }
/// <summary> /// Default constructor for the monitor control. /// </summary> /// <param name="settings">Current app settings</param> public MonitorControl(Settings settings) { Settings = settings; PackageList = new List <PackageDetails>(); WebService = new MobuWsClient(); WebService.Endpoint.Address = new EndpointAddress(Settings.WebServiceUrl); if (settings.WebServiceUrl.StartsWith("https")) { var binding = new BasicHttpsBinding(); binding.Security.Mode = BasicHttpsSecurityMode.Transport; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; WebService.Endpoint.Binding = binding; } else { var binding = new BasicHttpBinding(); WebService.Endpoint.Binding = binding; } var timeout = new TimeSpan(0, 0, 0, 0, Settings.WebServiceTimeout); WebService.Endpoint.Binding.OpenTimeout = timeout; WebService.Endpoint.Binding.CloseTimeout = timeout; WebService.Endpoint.Binding.SendTimeout = timeout; WebService.Endpoint.Binding.ReceiveTimeout = timeout; WebMonitor = new WebMonitor(this); PackageMonitor = new PackageMonitor(this, WebService); }
/// <inheritdoc/> public BLZServicePortTypeClient Create(EndpointAddress endpoint) { // set options if needed var binding = new BasicHttpsBinding(); return(new BLZServicePortTypeClient(binding, endpoint)); }
public async Task <ActionResult> TestWcfSample() { Console.WriteLine("Recieved authorized request to test WCF + JWT Sample"); ViewBag.Title = "Test WCF Sample"; var token = Request.GetOwinContext().Authentication.User.Claims.First(c => c.Type == ClaimTypes.Authentication)?.Value; // Specify the address to be used for the client. BasicHttpsBinding binding = new BasicHttpsBinding(); EndpointAddress address = new EndpointAddress(GetServiceUrl(HttpContext, "wcf") + "/valueservice.svc"); var sRef = new ValueService.ValueServiceClient(binding, address); sRef.Endpoint.EndpointBehaviors.Add(new JwtHeaderEndpointBehavior(new CloudFoundryOptions(ApplicationConfig.Configuration), token)); try { ViewBag.Message = await sRef.GetDataAsync(); } catch (Exception e) { Console.WriteLine(e); if (e.Message == "Unauthorized") { ViewBag.Message = "Request failed, you are not authorized!"; } else { ViewBag.Message = e.Message; } } return(View("Index")); }
public static async Task <string> Get_TIMSS_SessionID() { try { var basicHttpBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; var endpointAddress = new EndpointAddress(new Uri(Utility.PersonifySSOWebService_Default)); PersonifySSOWebService.SimpleWebServiceSoapClient client = new PersonifySSOWebService.SimpleWebServiceSoapClient(basicHttpBinding, endpointAddress); if (client.State == System.ServiceModel.CommunicationState.Faulted) { client.Abort(); client = new PersonifySSOWebService.SimpleWebServiceSoapClient(basicHttpBinding, endpointAddress); } string login = Utility.PIWSAcc_Login; string passwd = Utility.PIWSAcc_Password; string orgid = Utility.Pws_Acc_OrgId; string unitid = Utility.Pws_Acc_OrgUnitId; var ret = await client.ConnectAsync(login, passwd, orgid, unitid).ConfigureAwait(false); client.Abort(); return(ret.Token); } catch (Exception e) { string msg = e.Message; throw; } }
public static ChiliService.mainSoapClient SetupConnection(string url) { if (System.Net.ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls)) { System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; } if (true) { EndpointAddress endpointAddress = new EndpointAddress(url); if (url.Contains("https")) { BasicHttpsBinding basicHttpsBinding = new BasicHttpsBinding(); basicHttpsBinding.MaxReceivedMessageSize = int.MaxValue; basicHttpsBinding.OpenTimeout = new TimeSpan(0, 20, 0); basicHttpsBinding.CloseTimeout = new TimeSpan(0, 20, 0); basicHttpsBinding.SendTimeout = new TimeSpan(0, 20, 0); basicHttpsBinding.ReceiveTimeout = new TimeSpan(0, 20, 0); return(new ChiliService.mainSoapClient(basicHttpsBinding, endpointAddress)); } else { BasicHttpBinding basicHttpBinding = new BasicHttpBinding(); basicHttpBinding.MaxReceivedMessageSize = int.MaxValue; basicHttpBinding.OpenTimeout = new TimeSpan(0, 20, 0); basicHttpBinding.CloseTimeout = new TimeSpan(0, 20, 0); basicHttpBinding.SendTimeout = new TimeSpan(0, 20, 0); basicHttpBinding.ReceiveTimeout = new TimeSpan(0, 20, 0); return(new ChiliService.mainSoapClient(basicHttpBinding, endpointAddress)); } } return(null); }
private ServicoEnviarLoteEventosClient AlteraEndPoint() { if (this.CustomEndPoint) { var urlServicoEnvio = @"https://apiesocial2.vertech-it.com.br/vch-esocial/envialote?wsdl"; var address = new EndpointAddress(urlServicoEnvio); var binding = new BasicHttpsBinding(); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; var wsClient = new ServicoEnviarLoteEventosClient(binding, address); wsClient.ClientCredentials.UserName.UserName = Convert.ToString(this.Grupo); wsClient.ClientCredentials.UserName.Password = this.Token; wsClient.Endpoint.Behaviors.Add(new CustomEndpointCallBehavior(Convert.ToString(this.Grupo), this.Token)); return(wsClient); } var wsClientP = new ServicoEnviarLoteEventosClient(); wsClientP.Endpoint.Behaviors.Add(new CustomEndpointCallBehavior(Convert.ToString(this.Grupo), this.Token)); return(wsClientP); }
protected override Binding GetBinding() { var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; return(binding); }
protected override Binding GetBinding() { BasicHttpsBinding binding = new BasicHttpsBinding(BasicHttpsSecurityMode.TransportWithMessageCredential); binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate; return(binding); }