/// <summary> /// Get Inbound Service object /// </summary> /// <returns></returns> public static IOpportunityService GetService() { if (_opportunityService != null) { return(_opportunityService); } if (!RightNowConfigService.IsConfigured()) { return(null); } try { lock (_sync) { if (_opportunityService == null) { var opptyServiceUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.OSCOpptyServiceUrl); EndpointAddress endpoint = new EndpointAddress(opptyServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; //honoring config verb's value only if it is greater than 0 bytes. string maxResponseSize = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.SalesMaxReceivedMessageSize); if (!String.IsNullOrEmpty(maxResponseSize) && Convert.ToInt32(maxResponseSize) > 0) { binding.MaxReceivedMessageSize = Convert.ToInt32(maxResponseSize); } _opportunityService = new OpportunityService(); _opportunityService._opportunityClient = new OpportunityServiceClient(binding, endpoint); _opportunityService._opportunityClient.ClientCredentials.UserName.UserName = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.UserName); _opportunityService._opportunityClient.ClientCredentials.UserName.Password = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.Password); _opportunityService._opportunityClient.Endpoint.Behaviors.Add(new EmptyElementBehavior()); //_inboundService._log = ToaLogService.GetLog(); } } } catch (Exception e) { _opportunityService = null; MessageBox.Show(OSCExceptionMessages.OpportunityServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_opportunityService); }
/// <summary> /// Get Inbound Service object /// </summary> /// <returns></returns> public static IOpportunityService GetService() { if (_opportunityService != null) { return _opportunityService; } if (!RightNowConfigService.IsConfigured()) { return null; } try { lock (_sync) { if (_opportunityService == null) { var opptyServiceUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.OSCOpptyServiceUrl); EndpointAddress endpoint = new EndpointAddress(opptyServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; //honoring config verb's value only if it is greater than 0 bytes. string maxResponseSize = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.SalesMaxReceivedMessageSize); if (!String.IsNullOrEmpty(maxResponseSize) && Convert.ToInt32(maxResponseSize) > 0) { binding.MaxReceivedMessageSize = Convert.ToInt32(maxResponseSize); } _opportunityService = new OpportunityService(); _opportunityService._opportunityClient = new OpportunityServiceClient(binding, endpoint); _opportunityService._opportunityClient.ClientCredentials.UserName.UserName = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.UserName); _opportunityService._opportunityClient.ClientCredentials.UserName.Password = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.Password); _opportunityService._opportunityClient.Endpoint.Behaviors.Add(new EmptyElementBehavior()); //_inboundService._log = ToaLogService.GetLog(); } } } catch (Exception e) { _opportunityService = null; MessageBox.Show(OSCExceptionMessages.OpportunityServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return _opportunityService; }