コード例 #1
0
        void IClientMessageInspector.AfterReceiveReply(ref Message reply, object correlationState)
        {
            OperationHeaders operationHeaders;

            if (headersFromAction.TryGetValue((string)correlationState, out operationHeaders))
            {
                if (operationHeaders.Out.Count > 0)
                {
                    foreach (SoapHeaderAttribute header in operationHeaders.Out)
                    {
                        string           headerName = header.Name;
                        SoapHeaderHelper sh         = shHelpers[header.Type];
                        Headers[headerName] = sh.GetHeader(headerName, reply.Headers);
                    }
                }
            }
        }
コード例 #2
0
        internal static void AddSoapHeader(OperationDescription op, SoapHeaderAttribute soapHeader)
        {
            string headerNamespace          = SoapHeaderHelper.GetNamespace(soapHeader.Type);
            MessageHeaderDescription header = new MessageHeaderDescription(soapHeader.Name, headerNamespace);

            header.Type = soapHeader.Type;
            bool input  = ((soapHeader.Direction & SoapHeaderDirection.In) == SoapHeaderDirection.In);
            bool output = ((soapHeader.Direction & SoapHeaderDirection.Out) == SoapHeaderDirection.Out);

            foreach (MessageDescription msgDescription in op.Messages)
            {
                if ((msgDescription.Direction == MessageDirection.Input && input) ||
                    (msgDescription.Direction == MessageDirection.Output && output))
                {
                    msgDescription.Headers.Add(header);
                }
            }
        }
コード例 #3
0
        object IClientMessageInspector.BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            OperationHeaders operationHeaders;

            if (headersFromAction.TryGetValue(request.Headers.Action, out operationHeaders))
            {
                if (operationHeaders.In.Count > 0)
                {
                    foreach (SoapHeaderAttribute header in operationHeaders.In)
                    {
                        string headerName  = header.Name;
                        object headerValue = Headers[headerName];
                        if (headerValue != null)
                        {
                            SoapHeaderHelper sh = shHelpers[header.Type];
                            sh.AddHeader(headerName, headerValue, request.Headers);
                        }
                    }
                }
            }
            return(request.Headers.Action);
        }