/// <summary> /// Implements the WaitForRequest method of the IReplyChannel interface. It bridges the /// call to the inner channel located in the channel base. /// </summary> /// <param name="timeout">The System.Timespan that specifies how long a request operation has to complete /// before timing out and returning false</param> /// <returns>true if a request is received before the specified interval of time elapses; /// otherwise false</returns> public bool WaitForRequest(TimeSpan timeout) { WCFLogger.Write(TraceEventType.Verbose, "InterceptorReplyChannel waits for request"); bool succes = InnerChannel.WaitForRequest(timeout); return(succes); }
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)); }
void ICommunicationObject.Close(TimeSpan timeout) { if (State == CommunicationState.Opened) { InnerChannel.Close(timeout); } }
/// <summary> /// Implements the TryRecieveRequest method of the IReplyChannel interface. It bridges the /// call to the inner channel located in the channel base. /// </summary> /// <param name="timeout">The System.TimeSpan that specifies how long the receive of a request operation /// has to complete before timing out and returning false</param> /// <param name="context">The System.ServiceModel.Channels.RequestContext received</param> /// <returns>true if a request message is received before the specified interval of time /// elapses; otherwise false</returns> public bool TryReceiveRequest(TimeSpan timeout, out RequestContext context) { WCFLogger.Write(TraceEventType.Verbose, "InterceptorReplyChannel tries to receive request"); bool succes = InnerChannel.TryReceiveRequest(timeout, out context); return(succes); }
public bool TryReceive(TimeSpan timeout, out Message message) { bool retVal = InnerChannel.TryReceive(timeout, out message); this.InternalOnReceive(message); return(retVal); }
public virtual IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback asyncCallback, object state) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); WriteTransactionDataToMessage(message, sendMessageDirection); return(InnerChannel.BeginSend(message, timeoutHelper.RemainingTime(), asyncCallback, state)); }
public Message EndReceive(IAsyncResult result) { Message message = InnerChannel.EndReceive(result); this.InternalOnReceive(message); return(message); }
public bool EndTryReceive(IAsyncResult result, out Message message) { bool retVal = InnerChannel.EndTryReceive(result, out message); this.InternalOnReceive(message); return(retVal); }
public Message Receive(TimeSpan timeout) { Message message = InnerChannel.Receive(timeout); this.InternalOnReceive(message); return(message); }
public Message Receive() { Message message = InnerChannel.Receive(); this.InternalOnReceive(message); return(message); }
void ICommunicationObject.Open(TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); ChannelFactory.Open(timeoutHelper.RemainingTime()); InnerChannel.Open(timeoutHelper.RemainingTime()); }
/// <summary> /// Sends a message-based request and returns the correlated message-based response /// </summary> /// <param name="message">The request System.ServiceModel.Channels.Message to be transmitted</param> /// <returns>The System.ServiceModel.Channels.Message received in response to the request</returns> public Message Request(Message message) { WCFLogger.Write(TraceEventType.Start, "Beginning to intercept request"); base.ThrowIfDisposedOrNotOpen(); Message interceptedResponseMessage = null; try { Message interceptedRequestMessage = InterceptRequest(message); Message innerMessage = InnerChannel.Request(interceptedRequestMessage); interceptedResponseMessage = InterceptResponse(innerMessage); WCFLogger.Write(TraceEventType.Stop, "Finished intercepting request"); } catch (CryptographicException exception) { // Exception, if the service e.g. does not have acces to the private key in the certificate // So logging this special error this.logger.Fatal("The service migth not have permission right to the private key in the certificate", exception); // handling the error as normal HandleException(message); WCFLogger.Write(TraceEventType.Error, "Exception occurred while intercepting: " + exception); WCFLogger.Write(TraceEventType.Stop, "Finished intercepting request"); throw exception; } catch (Exception exception) { HandleException(message); WCFLogger.Write(TraceEventType.Error, "Exception occurred while intercepting: " + exception); WCFLogger.Write(TraceEventType.Stop, "Finished intercepting request"); throw exception; } return(interceptedResponseMessage); }
void ICommunicationObject.Close() { if (State == CommunicationState.Opened) { InnerChannel.Close(); } }
public bool EndTryReceiveRequest(IAsyncResult asyncResult, out RequestContext requestContext) { if (asyncResult == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("asyncResult"); } ReceiveTimeoutAsyncResult result = asyncResult as ReceiveTimeoutAsyncResult; if (result == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.AsyncEndCalledWithAnIAsyncResult))); } RequestContext innerContext; if (InnerChannel.EndTryReceiveRequest(result.InnerResult, out innerContext)) { requestContext = FinishReceiveRequest(innerContext, result.TimeoutHelper.RemainingTime()); return(true); } else { requestContext = null; return(false); } }
public virtual void Send(Message message, TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); WriteTransactionDataToMessage(message, sendMessageDirection); InnerChannel.Send(message, timeoutHelper.RemainingTime()); }
void ICommunicationObject.Abort() { if (State != CommunicationState.Closed) { InnerChannel.Abort(); ChannelFactory.Abort(); } }
public IAsyncResult BeginWaitForRequest( TimeSpan timeout, AsyncCallback callback, object state ) { return(InnerChannel.BeginWaitForRequest(timeout, callback, state)); }
public Message EndRequest(IAsyncResult result) { Message reply = InnerChannel.EndRequest(result); if (reply != null) { this.ReadIssuedTokens(reply, MessageDirection.Output); } return(reply); }
protected override void OnEndSend(IAsyncResult result) { Message responseMessage = InnerChannel.EndRequest(result); if (responseMessage != null) { this.EnqueueAndDispatch(responseMessage, null, false); } this.poller.EnsurePolling(this); }
/// <summary> /// Completes an asynchronous operation to return a message-based response to /// a transmitted request /// </summary> /// <param name="result">The System.IAsyncResult returned by a call to the System.ServiceModel.Channels.IInputChannel.BeginRequest() /// method</param> /// <returns>The System.ServiceModel.Channels.Message received in response to the request</returns> public Message EndRequest(IAsyncResult result) { Message innerMessage = InnerChannel.EndRequest(result); WCFLogger.Write(TraceEventType.Start, "Beginning to intercept response"); Message interceptedMessage = InterceptResponse(innerMessage); WCFLogger.Write(TraceEventType.Stop, "Finished intercepting response"); return(interceptedMessage); }
protected override void OnSend(Message message, TimeSpan timeout) { PrepareForSend(message); Message responseMessage = InnerChannel.Request(message, timeout); if (responseMessage != null) { this.EnqueueAndDispatch(responseMessage, null, false); } this.poller.EnsurePolling(this); }
internal void EndChannelClose(IAsyncResult result) { if (typeof(CompletedAsyncResult).IsAssignableFrom(result.GetType())) { CompletedAsyncResult.End(result); } else { InnerChannel.EndClose(result); } }
void ICommunicationObject.Open(TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); if (!_useCachedFactory) { GetChannelFactory().Open(timeoutHelper.RemainingTime()); } InnerChannel.Open(timeoutHelper.RemainingTime()); }
internal IAsyncResult BeginChannelClose(TimeSpan timeout, AsyncCallback callback, object state) { if (_channel != null) { return(InnerChannel.BeginClose(timeout, callback, state)); } else { return(new CompletedAsyncResult(callback, state)); } }
public void Abort() { WcfClientEventSource.Log.ChannelCalled(GetType().FullName, nameof(Abort)); try { InnerChannel.Abort(); } finally { Dispose(true); } }
public void Close(TimeSpan timeout) { WcfClientEventSource.Log.ChannelCalled(GetType().FullName, nameof(Close)); try { InnerChannel.Close(timeout); } finally { Dispose(true); } }
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context) { RequestContext innerContext; context = null; if (!InnerChannel.EndTryReceiveRequest(result, out innerContext)) { return(false); } context = WrapRequestContext(innerContext); return(true); }
public bool TryReceiveRequest(TimeSpan timeout, out RequestContext context) { RequestContext innerContext; if (InnerChannel.TryReceiveRequest(timeout, out innerContext)) { context = WrapRequestContext(innerContext); return(true); } context = null; return(false); }
public Message Request(Message message, TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); WriteTransactionDataToMessage(message, MessageDirection.Input); Message reply = InnerChannel.Request(message, timeoutHelper.RemainingTime()); if (reply != null) { this.ReadIssuedTokens(reply, MessageDirection.Output); } return(reply); }
protected override void OnClose(TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); if (exchangeTerminateMessage) { Message terminateSessionResponse = InnerChannel.Request( CreateTerminateSessionRequest(), timeoutHelper.RemainingTime()); ValidateTerminateSessionResponse(terminateSessionResponse); } base.Close(timeoutHelper.RemainingTime()); }