/// <summary> /// /// </summary> /// <param name="item"></param> /// <param name="value"></param> protected void FetchSubscribers(DataGridItem item) { DropDownList cboSubscribers = (DropDownList)item.FindControl("cboSubscribers"); if (cboSubscribers != null) { // Caricamento dei sottoscrittori configurati e raggiungibili tramite l'url indicato using (Subscriber.Proxy.SubscriberWebService ws = new Subscriber.Proxy.SubscriberWebService()) { ws.Url = Properties.Settings.Default.SubscriberWebServices; cboSubscribers.DataValueField = "Name"; cboSubscribers.DataTextField = "Name"; cboSubscribers.DataSource = ws.GetChannelList(); cboSubscribers.DataBind(); HiddenField hdSubscriber = (HiddenField)item.FindControl("hdSubscriber"); if (hdSubscriber != null && !string.IsNullOrEmpty(hdSubscriber.Value)) { cboSubscribers.SelectedValue = hdSubscriber.Value; } } } }
/// <summary> /// /// </summary> protected void FetchInstances() { using (Subscriber.Proxy.SubscriberWebService da = this.CreateService()) { this.grdInstances.SelectedIndex = -1; this.grdInstances.DataSource = da.GetChannelList(); this.grdInstances.DataBind(); this.ClearRules(); } }
/// <summary> /// Notifica evento al SubScriber /// </summary> /// <param name="channelRef"></param> /// <param name="logInfo"></param> /// <param name="obj"></param> /// <returns></returns> protected virtual Subscriber.Proxy.ListenerResponse NotifyEvent(ChannelRefInfo channelRef, VtDocs.LogInfo logInfo, Subscriber.Proxy.PublishedObject obj) { logger.Debug("Start. " + channelRef.ChannelName); Subscriber.Proxy.EventInfo eventInfo = new Subscriber.Proxy.EventInfo { EventName = logInfo.EventCode, EventDate = DateTime.Now, Author = new Subscriber.Proxy.EventAuthorInfo { Name = logInfo.UserName, RoleName = logInfo.RoleDescription }, PublishedObject = obj }; logger.DebugFormat("Eventname: {0}, Eventdate: {1}, Author user: {2}, Role {3}", eventInfo.EventName, eventInfo.EventDate.ToString(), eventInfo.Author.Name, eventInfo.Author.RoleName); Subscriber.Proxy.ListenerResponse response = null; Subscriber.Proxy.ChannelInfo channelInfo = null; using (Subscriber.Proxy.SubscriberWebService subscriber = new Subscriber.Proxy.SubscriberWebService()) { subscriber.Url = channelRef.SubscriberServiceUrl; logger.DebugFormat("Sub Url: {0}. Prelievo canali", subscriber.Url); Subscriber.Proxy.ChannelInfo[] channels = subscriber.GetChannelList(); if (channels != null) { logger.Debug("Channel trovati. N " + channels.Length + ""); for (int i = 0; i < channels.Length; i++) { logger.Debug(channels[i].Name); } channelInfo = channels.Where(e => e.Name == channelRef.ChannelName).First(); if (channelInfo == null) { // Istanza di pubblicazione non trovata nel subscriber collegato logger.Debug("Istanza di pubblicazione non trovata nel subscriber collegato"); throw new PublisherException(ErrorCodes.PUBLISH_CHANNEL_NOT_FOUND, ErrorDescriptions.PUBLISH_CHANNEL_NOT_FOUND); } } logger.Debug("Chiamo il notify Event"); response = subscriber.NotifyEvent( new Subscriber.Proxy.ListenerRequest { ChannelInfo = channelInfo, EventInfo = eventInfo } ); } return(response); }
/// <summary> /// Reperimento dei sottoscrittori disponibili nel sistema /// </summary> /// <returns></returns> private Subscriber.Proxy.ChannelInfo[] GetSubscribers(string serviceUrl) { //if (!this.PingSubscriberServices(serviceUrl)) // throw new ApplicationException("Servizio sottoscrittore non raggiungibile"); try { // Caricamento dei sottoscrittori configurati e raggiungibili tramite l'url indicato using (Subscriber.Proxy.SubscriberWebService ws = SubscriberServiceFactory.Create(serviceUrl)) return(ws.GetChannelList()); } catch (System.Web.Services.Protocols.SoapException soapEx) { ApplicationException ex = DocsPaUtils.Exceptions.SoapExceptionParser.GetOriginalException(soapEx); throw ex; } catch (Exception ex) { throw new ApplicationException("Servizio sottoscrittore non raggiungibile"); } }