예제 #1
0
        public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback asyncCallback, object state)
        {
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);

            WriteTransactionDataToMessage(message, MessageDirection.Input);
            return(InnerChannel.BeginRequest(message, timeoutHelper.RemainingTime(), asyncCallback, state));
        }
예제 #2
0
 /// <summary>
 /// BeginRequest implementation of IRequest channel
 /// </summary>
 /// <param name="message">The request System.ServiceModel.Channels.Message to be transmitted</param>
 /// <param name="timeout">The System.TimeSpan that specifies the interval of time within which a response
 /// must be received</param>
 /// <param name="callback">The System.AsyncCallback delegate that receives the notification of the completion
 ///     of the asynchronous operation transmitting a request message</param>
 /// <param name="state">An object, specified by the application, that contains state information
 /// associated with the asynchronous operation transmitting a request message</param>
 /// <returns>The System.IAsyncResult that references the asynchronous message transmission</returns>
 public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
 {
     WCFLogger.Write(TraceEventType.Verbose, "InterceptorReplyChannel begins request");
     ThrowIfDisposedOrNotOpen();
     try {
         Message interceptedMessage = InterceptRequest(message);
         return(InnerChannel.BeginRequest(interceptedMessage, timeout, callback, state));
     }
     catch (Exception ex) {
         WCFLogger.Write(TraceEventType.Error, "InterceptorReplyChannel exception thrown " + ex);
         HandleException(message);
         throw ex;
     }
 }
예제 #3
0
        /// <summary>
        /// Begins an asynchronous operation to transmit a request message to the reply-side
        /// of a request-reply message exchange
        /// </summary>
        /// <param name="message">The request System.ServiceModel.Channels.Message to be transmitted</param>
        /// <param name="callback">The System.AsyncCallback delegate that receives the notification of the completion
        ///     of the asynchronous operation transmitting a request message</param>
        /// <param name="state">An object, specified by the application, that contains state information
        /// associated with the asynchronous operation transmitting a request message</param>
        /// <returns>The System.IAsyncResult that references the asynchronous message transmission</returns>
        public IAsyncResult BeginRequest(Message message, AsyncCallback callback, object state)
        {
            base.ThrowIfDisposedOrNotOpen();
            IAsyncResult asyncResult = null;

            try
            {
                WCFLogger.Write(TraceEventType.Start, "Beginning to intercept request");
                Message interceptedMessage = InterceptRequest(message);
                WCFLogger.Write(TraceEventType.Stop, "Finished intercepting request");
                asyncResult = InnerChannel.BeginRequest(interceptedMessage, callback, state);
            }
            catch (Exception ex) {
                HandleException(message);
                WCFLogger.Write(TraceEventType.Error, "Exception occurred while intercepting: " + ex);
                throw ex;
            }

            return(asyncResult);
        }
예제 #4
0
 protected override IAsyncResult OnBeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
 {
     PrepareForSend(message);
     return(InnerChannel.BeginRequest(message, callback, state));
 }