Exemple #1
0
            /// <summary>
            /// Send the given events.
            /// </summary>
            /// <remarks>
            /// The function sets the member busId of the Event objects to the ID of this bus.
            /// </remarks>
            /// <param name="events">Array of events to be sent.</param>
            /// <returns>this object</returns>
            public Bus Send(Event[] events)
            {
                if (events != null && events.Length != 0)
                {
                    foreach (Event e in events)
                    {
                        e.busId = this.busId;
                    }
                    try
                    {
                        eventBusApi.conn.Ix.sendEvents(eventBusApi.eventBusSubsId, events);
                    }
                    catch (Exception ex)
                    {
                        BClient_Indexserver bclient = eventBusApi.bclient;
                        if (!bclient.getAuthentication().isReloginException(bclient, ex, 0))
                        {
                            throw ex;
                        }

                        BSyncResult <bool> syncResult = new BSyncResult <bool>();
                        bclient.getTransport().negotiateProtocolClient(syncResult);
                        syncResult.GetResult();

                        long subsId = eventBusApi.SubscriberId;
                        bclient.IXServicePortIF.sendEvents(subsId, events);
                    }
                }
                return(this);
            }
Exemple #2
0
 public IXConnection(IXConnFactory iXConnFactory,
                     BClient_Indexserver bclient, IXAuthentication auth, string url,
                     IXProperties connProps, IXProperties sessOpts)
 {
     this.iXConnFactory     = iXConnFactory;
     this.bclient           = bclient;
     this.auth              = auth;
     this.url               = url;
     this.connPropsVal      = connProps;
     this.sessionOptionsVal = sessOpts;
     this.ixVal             = new IXCachedConnIXServicePortIF(bclient.getTransport(), connProps);
     this.disposed          = false;
 }
Exemple #3
0
            /// <summary>
            /// Add the given event listener.
            /// </summary>
            /// <param name="eventListener">Event listener, the member busId will be internally set for each filter.</param>
            /// <returns>Listener ID</returns>
            public long AddListener(EventListener eventListener)
            {
                long lsnId = 0;

                if (eventListener != null && eventListener.filters != null && eventListener.filters.Length != 0)
                {
                    eventBusApi.ensureSubscriber();

                    foreach (EventFilter f in eventListener.filters)
                    {
                        f.busId = busId;
                    }

                    if (eventListeners == null)
                    {
                        eventListeners = new Dictionary <long, EventListener>();
                    }

                    try
                    {
                        lsnId = eventBusApi.conn.Ix.createEventBusListener(eventBusApi.SubscriberId, eventListener);
                        eventListeners[lsnId] = eventListener;
                    }
                    catch (Exception ex)
                    {
                        BClient_Indexserver bclient = eventBusApi.bclient;
                        if (!bclient.getAuthentication().isReloginException(bclient, ex, 0))
                        {
                            throw ex;
                        }

                        BSyncResult <bool> syncResult = new BSyncResult <bool>();
                        bclient.getTransport().negotiateProtocolClient(syncResult);
                        syncResult.GetResult();

                        long subsId = eventBusApi.SubscriberId;
                        lsnId = bclient.IXServicePortIF.createEventBusListener(subsId, eventListener);
                        eventListeners[lsnId] = eventListener;
                    }
                }
                return(lsnId);
            }
Exemple #4
0
        protected override void internalAuthenticate(BClient_Indexserver client, BAsyncResult <bool> asyncResult)
        {
            // Aktuelle ClientInfo bereitstellen, wg. Landessprache, Zeitzone usw.
            ClientInfo ci = getLoginResult().clientInfo;

            // Verbindungsobjekt für GET-Request
            IXWireClient wire = (IXWireClient)client.getTransport().getWire();

            HttpWebResponse resp = null;

            try
            {
                String loginServletUrl = wire.getUrlForAuthentication();

                long negotiatedVersion     = client.getTransport().getProtocol().negotiatedVersion;
                long negotiatedBypsVersion = client.getTransport().getProtocol().negotiatedBypsVersion;

                // Schreibe diese 9er Version für die Verbindung zu IX 9.0.
                // Weil bei ELO 9 ein String-Vergleich gemacht wird, wäre sonst die Version 10 kleiner als die Version 9
                loginServletUrl += "?streamversion=" + BVersioning.stringToLong("9.99.0.0");

                loginServletUrl += "&bstreamversion=" + BVersioning.longToString(negotiatedVersion);
                loginServletUrl += "&bversion=" + negotiatedBypsVersion;

                loginServletUrl += "&responseformat=byps-binary";
                if (ci.language != null)
                {
                    loginServletUrl += "&language=" + ci.language;
                }
                if (ci.timeZone != null)
                {
                    loginServletUrl += "&timezone=" + HttpUtility.UrlEncode(ci.timeZone);
                }
                if (ci.country != null)
                {
                    loginServletUrl += "&country=" + ci.country;
                }
                if (ci.callId != null)
                {
                    loginServletUrl += "&callid=" + HttpUtility.UrlEncode(ci.callId);
                }
                if (computerName != null)
                {
                    loginServletUrl += "&computerName=" + HttpUtility.UrlEncode(computerName);
                }

                // Sitzungskennung übergeben.
                // Sie wird direkt verworfen und es wird eine neue erstellt.
                loginServletUrl += "&sessionid=" + HttpUtility.UrlEncode(client.getTransport().getSessionId());

                if (WebRequest.DefaultWebProxy != null)
                {
                    WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials;
                }

                HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(loginServletUrl);
                req.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

                req.Credentials = CredentialCache.DefaultCredentials;

                //http://blogs.msdn.com/buckh/archive/2004/07/28/199706.aspx

                //CredentialCache credCache = new CredentialCache();
                //credCache.Add(new Uri(loginServletUrl), "NTLM",
                //              CredentialCache.DefaultNetworkCredentials);
                //req.Credentials = credCache;

                resp = (HttpWebResponse)req.GetResponse();

                if (resp.StatusCode != HttpStatusCode.OK)
                {
                    asyncResult(false, new BException((int)resp.StatusCode, "HTTP Status " + resp.StatusCode));
                }

                Stream     responseStream = resp.GetResponseStream();
                ByteBuffer buf            = BWire.bufferFromStream(responseStream, false);

                BMessageHeader header = new BMessageHeader();
                header.read(buf);

                // Neue Sitzungs-ID übernehmen
                if (!header.targetId.isZero())
                {
                    client.getTransport().setTargetId(header.targetId);
                    client.getTransport().setSessionId(header.sessionId);
                }

                BInput      bin         = client.getTransport().getInput(header, buf);
                LoginResult loginResult = (LoginResult)bin.load();

                this.setLoginResult(loginResult);
                asyncResult(false, null);
            }
            catch (Exception e)
            {
                asyncResult(false, e);
            }
            finally
            {
                if (resp != null)
                {
                    resp.Close();
                }
            }
        }