Exemple #1
0
        /// <summary>
        /// This method can be called from within a service operation
        /// to retrieve the CorrelationID associated with the TID of
        /// the message being processed by the service
        /// </summary>
        /// <returns>Returns the correlationID of the TID.  If the
        /// OperationContext, the TID or the correlationID cannot be found, it returns
        /// the empty string.</returns>
        public static string GetTIDCorrelationID()
        {
            string strCorrelationID = "";

            if (OperationContext.Current != null && OperationContext.Current.IncomingMessageHeaders != null)
            {
                MessageHeaders headers = OperationContext.Current.IncomingMessageHeaders;

                // get the TID object from the header
                ITID tid = TIDFactory.GetTIDFromMessage(headers);

                // if the TID was found, then set correlationID to the TID's correlationID
                if (tid != null)
                {
                    strCorrelationID = (string)tid.Get(TIDField.CORRELATIONID);
                }
            }

            return(strCorrelationID);
        }
Exemple #2
0
        /// <summary>
        /// This method can be called from within a service operation
        /// to retrieve the UserName associated with the TID of
        /// the message being processed by the service
        /// </summary>
        /// <returns>Returns the username of the TID.  If the
        /// OperationContext, the TID or the username cannot be found, it returns
        /// the empty string.</returns>
        public static string GetTIDUsername()
        {
            string strUsername = "";

            if (OperationContext.Current != null && OperationContext.Current.IncomingMessageHeaders != null)
            {
                MessageHeaders headers = OperationContext.Current.IncomingMessageHeaders;

                // get the TID object from the header
                ITID tid = TIDFactory.GetTIDFromMessage(headers);

                // if the TID was found, then set username to the TID's username
                if (tid != null)
                {
                    strUsername = (string)tid.Get(TIDField.USERNAME);
                }
            }

            return(strUsername);
        }
Exemple #3
0
        /// <summary>
        ///  This method can be called from within a service operation
        /// to retrieve the ParamList associated with the TID of
        /// the message being processed by the service
        /// </summary>
        /// <returns>Returns the ParamList of the TID.  If the
        /// OperationContext, the TID or the ParamList cannot be found,
        /// it returns null.</returns>
        public static Dictionary <string, string> GetTIDParamList()
        {
            Dictionary <string, string> paramList = null;

            if (OperationContext.Current != null && OperationContext.Current.IncomingMessageHeaders != null)
            {
                MessageHeaders headers = OperationContext.Current.IncomingMessageHeaders;

                // get the TID object from the header
                ITID tid = TIDFactory.GetTIDFromMessage(headers);

                // if the TID was found, then set correlationID to the TID's correlationID
                if (tid != null)
                {
                    paramList = (Dictionary <string, string>)tid.Get(TIDField.PARAMLIST);
                }
            }

            return(paramList);
        }