/// <summary> /// Called after the operation has returned but before the reply message is sent. /// </summary> /// <param name="reply"> /// The reply message. This value is null if the operation is one way. /// </param> /// <param name="correlationState"> /// The correlation object <see cref="WcfExecutionContext" />. /// </param> public void BeforeSendReply(ref Message reply, object correlationState) { if (reply == null) { return; } var ctx = (WcfExecutionContext)correlationState; /* * */ MessageBuffer buffer = reply.CreateBufferedCopy(Int32.MaxValue); reply = buffer.CreateMessage(); /* * TODO: pull from config */ var config = new MethodRawLoggingConfiguration() { Enabled = true, Request = true, Response = true }; if (config.Enabled == true) { string message = ToMessage(config.Response, buffer); Journal(ctx, true, message); } }
/// <summary> /// Called after an inbound message has been received but before the message is dispatched /// to the intended operation. /// </summary> /// <param name="request">The request message.</param> /// <param name="channel">The incoming channel.</param> /// <param name="instanceContext">The current service instance.</param> /// <returns> /// An instance of <see cref="WcfExecutionContext" />. This object is passed back to method /// <see cref="BeforeSendReply(ref Message, object)" />. /// </returns> public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { /* * */ MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue); request = buffer.CreateMessage(); /* * */ WcfExecutionContext ctx = WcfExecutionContext.Read(request); /* * TODO: pull from config */ var config = new MethodRawLoggingConfiguration() { Enabled = true, Request = true, Response = true }; if (config.Enabled == true) { string message = ToMessage(config.Response, buffer); Journal(ctx, false, message); } return(ctx); }