public void Use(Action <IXBInfoService> action) { NetTcpBinding binding = new NetTcpBinding(); string endpointUrl = _config["WCFExternalServices:XBInfoService:EndpointAddress"]; binding.MaxBufferPoolSize = 5242880; binding.MaxBufferSize = 6553600; binding.MaxReceivedMessageSize = 6553600; binding.ReaderQuotas.MaxArrayLength = 2500000; EndpointAddress endpoint = new EndpointAddress(endpointUrl); IXBInfoService client = ProxyManager <IXBInfoService> .GetProxy(nameof(IXBInfoService), binding, endpoint); byte Language = _cacheHelper.GetLanguage(); string ClientIP = _cacheHelper.GetClientIp(); XBSInfo.SourceType Source = (XBSInfo.SourceType)_cacheHelper.GetSourceType(); XBS.AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); XBSInfo.AuthorizedCustomer authorizedCustomerInfo = new XBSInfo.AuthorizedCustomer { CustomerNumber = authorizedCustomer.CustomerNumber, UserName = authorizedCustomer.UserName, UserId = authorizedCustomer.UserId }; client.InitOnlineAsync(ClientIP, Language, Source, authorizedCustomerInfo).Wait(); bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException ex) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException ex) { } catch (Exception ex) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public void Use(Action <IACBAOperationService> action) { NetTcpBinding binding = new NetTcpBinding(); binding.MaxBufferPoolSize = 5242880; binding.MaxBufferSize = 6553600; binding.MaxReceivedMessageSize = 6553600; binding.ReaderQuotas.MaxArrayLength = 2500000; string endpointUrl = _config["WCFExternalServices:ACBAOperationService:EndpointAddress"]; EndpointAddress endpoint = new EndpointAddress(endpointUrl); IACBAOperationService client = ProxyManager <IACBAOperationService> .GetProxy(nameof(IACBAOperationService), binding, endpoint); var operationServiceUser = _cacheHelper.GetOPUser(); operationServiceUser.UserSessionToken = _config["WCFExternalServices:ACBAOperationService:IdentificationToken"]; client.SetCurrentUserAsync(operationServiceUser).Wait(); bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException) { } catch (Exception) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public void Use(Action <IOnlineBankingSecurityCas> action) { IOnlineBankingSecurityCas client; string endpointUrl = _config["WCFExternalServices:XBSecurityService:EndpointAddress"]; EndpointAddress endpoint = new EndpointAddress(endpointUrl); if (endpointUrl.Contains("http://")) { client = ProxyManager <IOnlineBankingSecurityCas> .GetProxy(nameof(IOnlineBankingSecurityCas), new BasicHttpBinding(), endpoint); } else { client = ProxyManager <IOnlineBankingSecurityCas> .GetProxy(nameof(IOnlineBankingSecurityCas), new BasicHttpsBinding(), endpoint); } bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException) { } catch (Exception) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public void Use(Action <IContractOerationService> action) { NetTcpBinding binding = new NetTcpBinding(); binding.MaxBufferPoolSize = 5242880; binding.MaxBufferSize = 6553600; binding.MaxReceivedMessageSize = 6553600; binding.ReaderQuotas.MaxArrayLength = 2500000; string endpointUrl = _config["WCFExternalServices:ContractServiceRef:EndpointAddress"]; EndpointAddress endpoint = new EndpointAddress(endpointUrl); IContractOerationService client = ProxyManager <IContractOerationService> .GetProxy(nameof(IContractOerationService), binding, endpoint); bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException ex) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException ex) { } catch (Exception ex) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public void Use(Action <ISMSMessagingService> action) { NetTcpBinding binding = new NetTcpBinding(); string endpointUrl = _config["WCFExternalServices:SMSMessagingService:EndpointAddress"]; EndpointAddress endpoint = new EndpointAddress(endpointUrl); ISMSMessagingService client = ProxyManager <ISMSMessagingService> .GetProxy(nameof(ISMSMessagingService), binding, endpoint); var user = new User(); user.userID = 88; client.SetCurrentUserAsync(user).Wait(); bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException) { } catch (Exception ex) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public void Use(Action <INotificationService> action) { //BasicHttpBinding binding = new BasicHttpBinding(); for local and development BasicHttpsBinding binding = new BasicHttpsBinding(); //for prodoction string endpointUrl = _config["WCFExternalServices:PushNotificationService:EndpointAddress"]; EndpointAddress endpoint = new EndpointAddress(endpointUrl); INotificationService client = ProxyManager <INotificationService> .GetProxy(nameof(INotificationService), binding, endpoint); bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException) { } catch (Exception) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public void Use(Action <IXBManagementService> action) { NetTcpBinding binding = new NetTcpBinding { MaxBufferPoolSize = 5242880, MaxBufferSize = 6553600, MaxReceivedMessageSize = 6553600 }; binding.ReaderQuotas.MaxArrayLength = 2500000; string endpointUrl = _config["WCFExternalServices:XBManagementService:EndpointAddress"]; EndpointAddress endpoint = new EndpointAddress(endpointUrl); IXBManagementService client = ProxyManager <IXBManagementService> .GetProxy(nameof(IXBManagementService), binding, endpoint); User user = _authData.GetXBMUser(); SessionId = _contextAccessor.HttpContext.Request.Headers["SessionId"].ToString(); if (!string.IsNullOrEmpty(_contextAccessor.HttpContext.Request.Headers["language"])) { byte.TryParse(_contextAccessor.HttpContext.Request.Headers["language"], out language); } if (SessionId == "ba0f312d-8487-445e-aee2-d5877ac1d4de" && Convert.ToBoolean(_config["TestVersion"])) { clientIP = "169.169.169.166"; } else { clientIP = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); } bool success = false; bool checkCustomerSession = true; try { checkCustomerSession = client.InitAsync(SessionId, language, clientIP, user, (SourceType)_authData.GetSourceType(), ServiceType.CustomerService).Result; if (!checkCustomerSession) { throw new Exception(); } else { action(client); ((IClientChannel)client).Close(); success = true; } } catch (FaultException) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException) { } catch (Exception) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }