コード例 #1
0
        public void AfterReceiveReply(ref Message reply, object correlationState)
        {
            var index = reply.Headers.FindHeader("ExecutionHeader", "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices");

            if (index >= 0 && headers == null)
            {
                headers = new MessageHeaders(MessageVersion.Soap11);
                headers.CopyHeaderFrom(reply, reply.Headers.FindHeader("ExecutionHeader", "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices"));
            }
        }
コード例 #2
0
        /// <summary>
        /// Copy message header
        /// </summary>
        /// <param name="headerName">indicating the name of the header</param>
        /// <param name="headerNamespace">indicating the namespace of the header</param>
        /// <param name="source">indicating the source message header collection</param>
        /// <param name="destination">indicating the destination message header collection</param>
        public static void CopyMessageHeader(string headerName, string headerNamespace, MessageHeaders source, MessageHeaders destination)
        {
            int udIndex = source.FindHeader(headerName, headerNamespace);

            if (udIndex >= 0)
            {
                if (source.MessageVersion == destination.MessageVersion)
                {
                    // If the message version of source and destination matches, directly copy it from the source
                    destination.CopyHeaderFrom(source, udIndex);
                }
                else
                {
                    // add request message user data to response message header as an array of XmlNode.
                    XmlNode[] content = source.GetHeader <XmlNode[]>(udIndex);
                    destination.Add(MessageHeader.CreateHeader(headerName, headerNamespace, content));
                }
            }
        }