public void AfterReceiveReply(ref Message reply, object correlationState) { var action = currentAction.Value; var policy = OperationPolicy.GetPolicyForAction(action); var transformer = new MessageTransformer(reply); var responseDocument = transformer.GetXmlDocument(); if (!IsFault(responseDocument)) { if (debug) { Console.WriteLine("### Response wrapped: " + XmlUtil.AsText(responseDocument)); } securityService.UnwrapResponse(responseDocument, policy); } if (debug) { Console.WriteLine("### Response unwrapped: " + XmlUtil.PrettyXml(responseDocument)); } currentAction.Value = null; reply = transformer.ToMessage(responseDocument); }
public object BeforeSendRequest(ref Message request, IClientChannel channel) { var action = request.Headers.Action; currentAction.Value = action; var policy = OperationPolicy.GetPolicyForAction(action); var transformer = new MessageTransformer(request); var requestDocument = transformer.GetXmlDocument(); if (debug) { Console.WriteLine("### Request not wrapped: " + XmlUtil.PrettyXml(requestDocument)); } securityService.WrapRequest(requestDocument, policy); if (debug) { Console.WriteLine("### Request wrapped: " + XmlUtil.AsText(requestDocument)); } request = transformer.ToMessage(requestDocument); return(null); }