• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MessageHeaders类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DefaultMessageBuffer

		internal DefaultMessageBuffer (int maxBufferSize, MessageHeaders headers, MessageProperties properties, BodyWriter body, bool isFault)
		{
			this.max_buffer_size = maxBufferSize;
			this.headers = headers;
			this.body = body;
			this.closed = false;
			this.is_fault = isFault;
			this.properties = properties;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:MessageBufferImpl.cs


示例17: DelegatingHeader

        public DelegatingHeader(MessageHeaderInfo info, MessageHeaders originalHeaders)
        {
            Fx.Assert(info != null, "info is required");
            Fx.Assert(originalHeaders != null, "originalHeaders is required");

            this.info = info;
            this.originalHeaders = originalHeaders;
            this.index = -1;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:DelegatingHeader.cs


示例18: SerializeWithAllSerializableHeaders

 public void SerializeWithAllSerializableHeaders()
 {
     IDictionary<string, object> map = new Dictionary<string, object>();
     map.Add("name", "joe");
     map.Add("age", 42);
     MessageHeaders input = new MessageHeaders(map);
     MessageHeaders output = (MessageHeaders) SerializeAndDeserialize(input);
     Assert.That(output.Get("name"), Is.EqualTo("joe"));
     Assert.That(output.Get("age"), Is.EqualTo(42));
 }
开发者ID:rlxrlxrlx,项目名称:spring-net-integration,代码行数:10,代码来源:MessageHeadersTests.cs


示例19: HttpStreamMessage

 public HttpStreamMessage(MessageHeaders headers, MessageProperties properties, BodyWriter bodyWriter)
 {
     if (bodyWriter == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bodyWriter");
     }
     this.headers = new MessageHeaders(headers);
     this.properties = new MessageProperties(properties);
     this.bodyWriter = bodyWriter;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:HttpStreamMessage.cs


示例20: GetHeaderUri

 public static Uri GetHeaderUri(MessageHeaders headers, string name, string ns)
 {
     Uri uri = null;
     string uriString = GetHeaderString(headers, name, ns);
     if (uriString != null)
     {
         uri = new Uri(uriString);
     }
     return uri;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:PeerMessageHelpers.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MessageImportance类代码示例发布时间:2022-05-24
下一篇:
C# MessageHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap