public override void Close() { if (!bProxyOwner) { return; } if (proxy != null) { try { this.proxy.Dispose(); } catch (TimeoutException) { this.proxy.Abort(); } catch (CommunicationException) { this.proxy.Abort(); } } this.proxy = null; this.service = null; this.open = false; }
public Subscription(InfoServiceProxy swis, string endpointAddress, string query, string binding = "NetTcp", string dataFormat = "Xml", CredentialType credentialType = CredentialType.Certificate, string username = null, string password = null) { this.swis = swis; PropertyBag propertyBag = new PropertyBag { { "Query", query }, { "EndpointAddress", endpointAddress }, { "Description", "SWQL Studio" }, { "DataFormat", dataFormat }, { "CredentialType", credentialType.ToString() } }; if (!string.IsNullOrEmpty(binding)) { propertyBag["Binding"] = binding; } if (credentialType == CredentialType.Username) { propertyBag.Add("Username", username); propertyBag.Add("Password", password); } SubscriptionUri = swis.Create(systemSubscription, propertyBag); }
public void Connect() { if (_proxy == null || (_proxy != null && (_proxy.Channel.State == CommunicationState.Closed || _proxy.Channel.State == CommunicationState.Faulted))) { if (_proxy != null) { _proxy.Dispose(); } _proxy = _infoServiceType.CreateProxy(_server); _proxy.OperationTimeout = TimeSpan.FromMinutes(Settings.Default.OperationTimeout); _proxy.ChannelFactory.Endpoint.Behaviors.Add(new LogHeaderReaderBehavior()); _proxy.Open(); } Connection = new InformationServiceConnection((IInformationService)_proxy); Connection.Open(); if (Settings.Default.UseActiveSubscriber && _infoServiceType.SupportsActiveSubscriber) { _notificationDeliveryServiceProxy = _infoServiceType.CreateNotificationDeliveryServiceProxy(_server, NotificationSubscriber); _notificationDeliveryServiceProxy.Open(); _activeSubscriberAddress = string.Format("active://{0}/SolarWinds/SwqlStudio/{1}", Utility.GetFqdn(), Process.GetCurrentProcess().Id); _notificationDeliveryServiceProxy.ReceiveIndications(_activeSubscriberAddress); _activeSubscriberInfo = new SubscriberInfo() { EndpointAddress = _activeSubscriberAddress, OpenedSuccessfully = true, DataFormat = "Xml" }; } }
private void CreateProxy() { if (endpointName.Length != 0) { if (remoteAddress != null) { if (credentials != null) { this.proxy = new InfoServiceProxy(endpointName, remoteAddress, credentials); } else { this.proxy = new InfoServiceProxy(endpointName, remoteAddress); } } else { if (credentials != null) { this.proxy = new InfoServiceProxy(endpointName, credentials); } else { this.proxy = new InfoServiceProxy(endpointName); } } this.service = this.proxy; } }
public void Close() { if (_proxy != null) { _proxy.Dispose(); _proxy = null; } }
public InformationServiceConnection(InfoServiceProxy proxy, bool takeOwnership) { this.service = proxy; bProxyOwner = takeOwnership; if (bProxyOwner) { this.proxy = proxy; } }
public void Close() { if (_proxy != null) { var listeners = ConnectionClosing; listeners?.Invoke(this, EventArgs.Empty); _proxy.Dispose(); _proxy = null; listeners = ConnectionClosed; listeners?.Invoke(this, EventArgs.Empty); } }
public void Close() { if (_proxy != null) { _proxy.Dispose(); _proxy = null; var listeners = ConnectionClosed; if (listeners != null) { listeners.Invoke(this, EventArgs.Empty); } } }
private string BuildKartablEmailString(IList <decimal> items, InfoServiceProxy proxy) { string message = ""; if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi) { message = String.Format("همکار گرامی {0} {1} شما {2} آیتم بررسی نشده در کارتابل خود دارید", proxy.Sex == PersonSex.Male ? "جناب آقای " : "سرکار خانم", proxy.PersonName, items.Count); } else { message = String.Format("Dear colleague , {0} {1} , Your have {3} Under Review Items in your kartabl", proxy.Sex == PersonSex.Male ? "Mr. " : "Mis.", proxy.PersonName, items.Count); } return(message); }
private string BuildConfirmedRequestEmailString(IList <decimal> items, InfoServiceProxy proxy) { string message = ""; if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi) { message = String.Format("همکار گرامی {0} {1} شما {2} درخواست تایید شده دارید", proxy.Sex == PersonSex.Male ? "جناب آقای " : "سرکار خانم", proxy.PersonName, items.Count); } else { message = String.Format("Dear colleague , {0} {1} , Your have {3} confirmed Request", proxy.Sex == PersonSex.Male ? "Mr. " : "Mis.", proxy.PersonName, items.Count); } return(message); }
private InformationServiceSubscriptionProvider( Func <string, InfoServiceProxy> proxyFactory, string netObjectOperationEndpoint) { if (!RegistrySettings.IsFullOrion()) { throw new InvalidOperationException("Subscription of Indications on non primary poller."); } if (string.IsNullOrEmpty(netObjectOperationEndpoint)) { throw new ArgumentException(nameof(netObjectOperationEndpoint)); } this.netObjectOperationEndpoint = netObjectOperationEndpoint; this.swisProxy = proxyFactory("localhost"); }
public void Connect() { if (_proxy == null || (_proxy != null && (_proxy.Channel.State == CommunicationState.Closed || _proxy.Channel.State == CommunicationState.Faulted))) { if (_proxy != null) { _proxy.Dispose(); } _proxy = _infoServiceType.CreateProxy(_server); _proxy.OperationTimeout = TimeSpan.FromMinutes(Settings.Default.OperationTimeout); _proxy.ChannelFactory.Endpoint.Behaviors.Add(new LogHeaderReaderBehavior()); _proxy.Open(); } Connection = new InformationServiceConnection((IInformationService)_proxy); Connection.Open(); }
/// <summary> /// تنظیمات اس ام اس را برای کل سازمان برمیگرداند /// </summary> /// <returns></returns> public IList <InfoServiceProxy> GetAllSmsSettings() { try { IList <InfoServiceProxy> proxyList = new List <InfoServiceProxy>(); IList <UserSettings> settingList = base.GetAll(); var result = from o in settingList where o.SMSSettings != null && o.SMSSettings.Active select o.SMSSettings; IList <SMSSettings> smsSettingList = result.ToList <SMSSettings>(); foreach (SMSSettings setting in smsSettingList) { InfoServiceProxy proxy = new InfoServiceProxy(); proxy.PersonId = setting.UserSetting.User.Person.ID; proxy.PersonName = setting.UserSetting.User.Person.Name; proxy.PersonCode = setting.UserSetting.User.Person.PersonCode; proxy.Sex = setting.UserSetting.User.Person.Sex; proxy.SendByDay = setting.SendByDay; proxy.EmailAddress = setting.UserSetting.User.Person.PersonDetail.EmailAddress; proxy.SmsNumber = setting.UserSetting.User.Person.PersonDetail.MobileNumber; if (setting.SendByDay) { proxy.RepeatePeriod = new TimeSpan(setting.DayCount, ((int)setting.DayHour / 60), setting.DayHour % 60, 0); } else { proxy.RepeatePeriod = new TimeSpan(((int)setting.Hour / 60), setting.Hour % 60, 0); } proxyList.Add(proxy); } return(proxyList); } catch (Exception ex) { LogException(ex); throw ex; } }
private Subscription SubscribeHttp(InfoServiceProxy proxy, string query, SubscriberInfo subscriberInfo) { return(new Subscription(proxy, subscriberInfo.EndpointAddress, query, subscriberInfo.Binding, subscriberInfo.DataFormat, CredentialType.Username, "subscriber", "subscriber")); }
private Subscription SubscribeNetTcp(InfoServiceProxy proxy, string query, SubscriberInfo subscriberInfo) { return(new Subscription(proxy, subscriberInfo.EndpointAddress, query, subscriberInfo.Binding, subscriberInfo.DataFormat)); }
private InfoServiceProxy ConnectNetTcp() { InfoServiceProxy infoServiceProxy; EndpointAddresses addresses = V2.IsPresent ? (EndpointAddresses) new V2EndpointAddresses() : new V3EndpointAddresses(); if (Trusted.IsPresent) { var binding = new NetTcpBinding { MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue }; binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows; var uri = new Uri(string.Format(addresses.activeDirectory, Hostname ?? "localhost")); infoServiceProxy = new InfoServiceProxy(uri, binding, new WindowsCredential()); } else if (Certificate.IsPresent) { var binding = new NetTcpBinding(SecurityMode.Transport) { MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue }; binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate; binding.ReaderQuotas.MaxArrayLength = int.MaxValue; binding.ReaderQuotas.MaxStringContentLength = int.MaxValue; if (Streamed.IsPresent) { binding.TransferMode = TransferMode.Streamed; binding.PortSharingEnabled = true; binding.ReceiveTimeout = new TimeSpan(15, 0, 0); binding.SendTimeout = new TimeSpan(15, 0, 0); } var address = (Streamed && !V2.IsPresent) ? ((V3EndpointAddresses)addresses).streamedCertificate : addresses.certificate; var uri = new Uri(string.Format(address, Hostname ?? "localhost")); ServiceCredentials credentials = new MyCertificateCredential("SolarWinds-Orion", StoreLocation.LocalMachine, StoreName.My); infoServiceProxy = new InfoServiceProxy(uri, binding, credentials); } else { var binding = new NetTcpBinding { MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue }; binding.Security.Mode = SecurityMode.TransportWithMessageCredential; binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; var uri = new Uri(string.Format(addresses.usernamePassword, Hostname ?? "localhost")); string username = string.Empty; string password = string.Empty; if (IsUserNamePresent) { SecureString securePassword = StringToSecureString(Password); Credential = new PSCredential(UserName, securePassword); } // the credential dialog adds a slash at the beginning, need to strip username = Credential.UserName.TrimStart('\\'); password = SecureStringToString(Credential.Password); var credentials = new UsernameCredentials(username, password); infoServiceProxy = new InfoServiceProxy(uri, binding, credentials); } return(infoServiceProxy); }
//This is required by NCM. NCM provide it's own proxy object public InformationServiceConnection(InfoServiceProxy proxy) : this(proxy, false) { }