当前位置: 首页>>代码示例>>C#>>正文


C# MessageHeaders类代码示例

本文整理汇总了C#中MessageHeaders的典型用法代码示例。如果您正苦于以下问题:C# MessageHeaders类的具体用法?C# MessageHeaders怎么用?C# MessageHeaders使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MessageHeaders类属于命名空间,在下文中一共展示了MessageHeaders类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddHeaders

 public void AddHeaders(MessageHeaders headers)
 {
     if (headers.MessageVersion.Envelope == EnvelopeVersion.Soap11)
     {
         headers.Add(new WSAddressing10ProblemHeaderQNameHeader(this.invalidHeaderName));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:WSAddressing10ProblemHeaderQNameFault.cs

示例2: AddNotUnderstoodHeaders

 private void AddNotUnderstoodHeaders(MessageHeaders headers)
 {
     for (int i = 0; i < _notUnderstoodHeaders.Count; ++i)
     {
         headers.Add(new NotUnderstoodHeader(_notUnderstoodHeaders[i].Name, _notUnderstoodHeaders[i].Namespace));
     }
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:7,代码来源:MustUnderstandSoapException.cs

示例3: AddressingProperty

 public AddressingProperty(MessageHeaders headers)
 {
     this.action = headers.Action;
     this.to = headers.To;
     this.replyTo = headers.ReplyTo;
     this.messageId = headers.MessageId;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AddressingProperty.cs

示例4: ReadMessage

 public static CreateSequenceInfo ReadMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, Message message, MessageHeaders headers)
 {
     CreateSequenceInfo info;
     if (message.IsEmpty)
     {
         string reason = System.ServiceModel.SR.GetString("NonEmptyWsrmMessageIsEmpty", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) });
         Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason)));
     }
     using (XmlDictionaryReader reader = message.GetReaderAtBodyContents())
     {
         info = CreateSequence.Create(messageVersion, reliableMessagingVersion, securitySession, reader);
         message.ReadFromBodyContentsToEnd(reader);
     }
     info.SetMessageId(messageVersion, headers);
     info.SetReplyTo(messageVersion, headers);
     if (info.AcksTo.Uri != info.ReplyTo.Uri)
     {
         string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualReplyTo");
         Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str2, new ProtocolException(str2)));
     }
     info.to = message.Headers.To;
     if ((info.to == null) && (messageVersion.Addressing == AddressingVersion.WSAddressing10))
     {
         info.to = messageVersion.Addressing.AnonymousUri;
     }
     return info;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:CreateSequenceInfo.cs

示例5: LocalByRefMessage

 internal LocalByRefMessage(MessageVersion version, string action, int id)
     : base()
 {
     this.headers = new MessageHeaders(version);
     this.headers.Action = action;
     this.data = id;
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:7,代码来源:LocalByRefMessage.cs

示例6: AddNotUnderstoodHeaders

 private void AddNotUnderstoodHeaders(MessageHeaders headers)
 {
     for (int i = 0; i < this.notUnderstoodHeaders.Count; i++)
     {
         headers.Add(new NotUnderstoodHeader(this.notUnderstoodHeaders[i].Name, this.notUnderstoodHeaders[i].Namespace));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:MustUnderstandSoapException.cs

示例7: AdwsRequestMsg

		protected AdwsRequestMsg(string instance)
		{
			this._messageProperties = new MessageProperties();
			this._messageHeaders = new MessageHeaders(this.Version, 7);
			this.Headers.Action = this.Action;
			this.Headers.Add(MessageHeader.CreateHeader("instance", "http://schemas.microsoft.com/2008/1/ActiveDirectory", instance));
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:AdwsRequestMsg.cs

示例8: AmfMessageBase

        /// <summary>
        /// Constructor.
        /// </summary>
        protected AmfMessageBase()
        {
            _properties = new MessageProperties();

            //Make sure that there is no wrapping applied to this message
            _headers = new MessageHeaders(MessageVersion.None);
        }
开发者ID:artema,项目名称:DotAmf,代码行数:10,代码来源:AmfMessageBase.cs

示例9: ExtractActivityAndCorrelationId

        public static bool ExtractActivityAndCorrelationId(MessageHeaders headers, out Guid activityId, out Guid correlationId)
        {
            if (headers == null) throw new ArgumentNullException(nameof(headers));

            activityId = Guid.Empty;
            correlationId = Guid.Empty;

            try
            {
                var index = headers.FindHeader("ActivityId", "http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics");
                if (index >= 0)
                {
                    using (var reader = headers.GetReaderAtHeader(index))
                    {
                        correlationId = new Guid(reader.GetAttribute("CorrelationId", null));
                        activityId = reader.ReadElementContentAsGuid();
                        return true;
                    }
                }
            }
            catch
            {
                if (Debugger.IsAttached)
                {
                    throw;
                }
            }

            return false;
        }
开发者ID:Zywave,项目名称:SMLogging,代码行数:30,代码来源:MessageHelpers.cs

示例10: ApplySecurityAndWriteHeaders

        public void ApplySecurityAndWriteHeaders(MessageHeaders headers, XmlDictionaryWriter writer, SecurityIdGenerator securityIdGenerator)
        {
            // There is no way to look through the headers attributes without changing the way
            // Headers.WriterStartHeader / headers.writeHeadercontents writes the header
            // So i'm using a copy that I can change without worries.
            MessageHeaders copyHeaders = new MessageHeaders(headers);

            for (int i = 0; i < headers.Count; i++)
            {
                MessageHeaderInfo header = headers[i];

                // We are not supporting another d:Security header, throw if there is already one in the message
                if (this.IsSecurityElement(header))
                {
                    throw new ArgumentException("The message already contains a d:security header.");
                }

                if (this.ShouldProtectHeader(header))
                {
                    string headerId;
                    bool idInserted;
                    this.GetHeaderId(copyHeaders.GetReaderAtHeader(i), securityIdGenerator, true, out headerId, out idInserted);

                    // Add a reference for this header
                    this.signer.AddReference(headers, i, writer, headerId, idInserted);
                }
                else
                {
                    headers.WriteHeader(i, writer);
                }
            }
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:32,代码来源:SendCompactSignatureHeader.cs

示例11: TestConstructor

		public void TestConstructor ()
		{
			MessageHeaders headers = new MessageHeaders (MessageVersion.Soap12WSAddressing10);
			Assert.AreEqual (0, headers.Count);

			headers = new MessageHeaders (MessageVersion.Default);
			Assert.AreEqual (0, headers.Count);
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:MessageHeadersTest.cs

示例12: ReturnHeaders

 public void ReturnHeaders(MessageHeaders headers)
 {
     if (headers.CanRecycle)
     {
         headers.Recycle(this.HeaderInfoCache);
         this.recycledHeaders = headers;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:RecycledMessageState.cs

示例13: SetMessageId

 protected void SetMessageId(MessageVersion messageVersion, MessageHeaders headers)
 {
     this.messageId = headers.MessageId;
     if (this.messageId == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageHeaderException(System.ServiceModel.SR.GetString("MissingMessageIdOnWsrmRequest", new object[] { this.RequestName }), messageVersion.Addressing.Namespace, "MessageID", false));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:WsrmRequestInfo.cs

示例14: AddressingProperty

        public AddressingProperty(MessageHeaders headers)
        {
            Fx.Assert(null != headers, "");

            this.action = headers.Action;
            this.to = headers.To;
            this.replyTo = headers.ReplyTo;
            this.messageId = headers.MessageId;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:AddressingProperty.cs

示例15: ChunkingMessage

 internal ChunkingMessage(MessageVersion version, string action, ChunkingReader reader, Guid messageId)
 {
     this.version = version;
     this.chunkReader = reader;
     this.properties = new MessageProperties();
     this.headers = new MessageHeaders(this.version);
     this.headers.Action = action;
     this.messageId = messageId;
 }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:9,代码来源:ChunkingMessage.cs


注:本文中的MessageHeaders类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。