Beispiel #1
0
 public override ArraySegment <byte> WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset)
 {
     if (WriteMessagesToConsole)
     {
         var messageTransformer = new MessageTransformer(message);
         var xmlDocument        = messageTransformer.GetXmlDocument();
         Console.WriteLine("OUTGOING MESSAGE: " + xmlDocument.OuterXml);
         return(innerEncoder.WriteMessage(messageTransformer.ToMessage(xmlDocument), maxMessageSize, bufferManager, messageOffset));
     }
     return(innerEncoder.WriteMessage(message, maxMessageSize, bufferManager, messageOffset));
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }