本文整理汇总了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));
}
}
示例3: AddressingProperty
public AddressingProperty(MessageHeaders headers)
{
this.action = headers.Action;
this.to = headers.To;
this.replyTo = headers.ReplyTo;
this.messageId = headers.MessageId;
}
示例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;
}
示例5: LocalByRefMessage
internal LocalByRefMessage(MessageVersion version, string action, int id)
: base()
{
this.headers = new MessageHeaders(version);
this.headers.Action = action;
this.data = id;
}
示例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));
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例12: ReturnHeaders
public void ReturnHeaders(MessageHeaders headers)
{
if (headers.CanRecycle)
{
headers.Recycle(this.HeaderInfoCache);
this.recycledHeaders = headers;
}
}
示例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));
}
}
示例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;
}
示例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;
}