本文整理汇总了C#中MessageHeaders.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MessageHeaders.Add方法的具体用法?C# MessageHeaders.Add怎么用?C# MessageHeaders.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageHeaders
的用法示例。
在下文中一共展示了MessageHeaders.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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
示例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: 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
示例4: AddHeader
internal static void AddHeader(MessageHeaders headers, MessageHeader hContext)
{
headers.Add(hContext);
}
示例5: AddMessageHeaderForParameter
private void AddMessageHeaderForParameter(MessageHeaders headers, PartInfo headerPart, MessageVersion messageVersion, object parameterValue, bool isXmlElement)
{
string str;
bool flag;
bool flag2;
MessageHeaderDescription headerDescription = (MessageHeaderDescription) headerPart.Description;
object headerValue = OperationFormatter.GetContentOfMessageHeaderOfT(headerDescription, parameterValue, out flag, out flag2, out str);
if (isXmlElement)
{
if (headerValue != null)
{
XmlElement element = (XmlElement) headerValue;
headers.Add(new OperationFormatter.XmlElementMessageHeader(this, messageVersion, element.LocalName, element.NamespaceURI, flag, str, flag2, element));
}
}
else
{
headers.Add(new DataContractSerializerMessageHeader(headerPart, headerValue, flag, str, flag2));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:DataContractSerializerOperationFormatter.cs
示例6: AddMessageHeaderForParameter
private void AddMessageHeaderForParameter(MessageHeaders headers, PartInfo headerPart, MessageVersion messageVersion, object parameterValue, bool isXmlElement)
{
string actor;
bool mustUnderstand;
bool relay;
MessageHeaderDescription headerDescription = (MessageHeaderDescription)headerPart.Description;
object valueToSerialize = GetContentOfMessageHeaderOfT(headerDescription, parameterValue, out mustUnderstand, out relay, out actor);
if (isXmlElement)
{
if (valueToSerialize == null)
return;
XmlElement xmlElement = (XmlElement)valueToSerialize;
headers.Add(new XmlElementMessageHeader(this, messageVersion, xmlElement.LocalName, xmlElement.NamespaceURI, mustUnderstand, actor, relay, xmlElement));
return;
}
headers.Add(new DataContractSerializerMessageHeader(headerPart, valueToSerialize, mustUnderstand, actor, relay));
}
示例7: TestAddMethod
public void TestAddMethod()
{
MessageHeaders messageHeaders = new MessageHeaders(null);
messageHeaders.Add("foo", "bar");
}
示例8: TestAddKeyValuePairMethod
public void TestAddKeyValuePairMethod()
{
MessageHeaders messageHeaders = new MessageHeaders(null);
messageHeaders.Add(new KeyValuePair<string, object>("foo", "bar"));
}
示例9: CloneHeaders
void CloneHeaders(MessageHeaders targetHeaders, MessageHeaders sourceHeaders, Uri to, HashSet<string> understoodHeadersSet)
{
for (int i = 0; i < sourceHeaders.Count; ++i)
{
MessageHeaderInfo header = sourceHeaders[i];
if (!understoodHeadersSet.Contains(MessageHeaderKey(header)))
{
//If Actor is SOAP Intermediary ("*actor/next" which is us) check the Relay flag
if (!ActorIsNextDestination(header, sourceHeaders.MessageVersion) || header.Relay)
{
//Always wrap the header because BufferedHeader isn't smart enough to allow custom
//headers to switch message versions
MessageHeader messageHeader = new DelegatingHeader(header, sourceHeaders);
targetHeaders.Add(messageHeader);
}
}
}
// To and Action (already specified) are 'special' and may be set even with AddressingVersion.None
targetHeaders.To = to;
if (targetHeaders.MessageVersion.Addressing != AddressingVersion.None)
{
//These are used as correlation IDs. Copy these regardless of manual addressing.
targetHeaders.MessageId = sourceHeaders.MessageId;
targetHeaders.RelatesTo = sourceHeaders.RelatesTo;
if (this.manualAddressing)
{
//These are addresses, only copy when ManualAddressing is enabled
targetHeaders.FaultTo = sourceHeaders.FaultTo;
targetHeaders.ReplyTo = sourceHeaders.ReplyTo;
targetHeaders.From = sourceHeaders.From;
}
}
}
示例10: CopyHeadersFrom_Merge
public void CopyHeadersFrom_Merge ()
{
var h1 = new MessageHeaders (MessageVersion.Default);
var h2 = new MessageHeaders (MessageVersion.Default);
h1.Add (MessageHeader.CreateHeader ("Action", wsa1, "urn:foo"));
h2.Add (MessageHeader.CreateHeader ("Action", wsa1, "urn:bar"));
h1.CopyHeadersFrom (h2); // it somehow allow dups!
Assert.Fail (String.Format ("Action should not be caught", h1.Action)); // access to Action results in an error. If it does not, then simply assert fail.
}
示例11: DuplicateActionFindError
public void DuplicateActionFindError ()
{
MessageHeaders headers = new MessageHeaders (MessageVersion.Default);
headers.Add (MessageHeader.CreateHeader ("Action", wsa1, "urn:foo"));
headers.Add (MessageHeader.CreateHeader ("Action", wsa1, "urn:bar"));
Assert.Fail (String.Format ("Action should not be caught", headers.Action)); // access to Action results in an error. If it does not, then simply assert fail.
}
示例12: AddDuplicate2
public void AddDuplicate2 ()
{
MessageHeaders headers = new MessageHeaders (MessageVersion.Default);
headers.Add (MessageHeader.CreateHeader ("Action", wsa1, "urn:foo", true, "whoa"));
headers.Add (MessageHeader.CreateHeader ("Action", wsa1, "urn:bar", true, "whee"));
}
示例13: TestAction
public void TestAction ()
{
Message m = Message.CreateMessage (MessageVersion.Default, "test", 1);
m.Headers.Add (MessageHeader.CreateHeader ("FirstHeader", "ns", "first"));
Assert.AreEqual ("test", m.Headers.Action, "#1");
MessageHeaders headers = new MessageHeaders (MessageVersion.Default, 1);
Assert.AreEqual (null, headers.Action, "#2");
headers.Add (MessageHeader.CreateHeader ("Action", "http://www.w3.org/2005/08/addressing", "test"));
MessageHeaderInfo info = headers [0];
Assert.AreEqual ("Action", info.Name, "#2-1");
Assert.AreEqual ("http://www.w3.org/2005/08/addressing", info.Namespace, "#2-2");
Assert.AreEqual (false, info.MustUnderstand, "#2-3");
Assert.AreEqual (String.Empty, info.Actor, "#2-4");
Assert.AreEqual ("test", headers.Action, "#3");
headers.Clear ();
Assert.AreEqual (null, headers.Action, "#4");
}
示例14: GetHeaderNullSerializer2
public void GetHeaderNullSerializer2 ()
{
MessageHeaders headers = new MessageHeaders (MessageVersion.Default);
string ns = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
headers.Add (MessageHeader.CreateHeader ("Action", ns, "urn:foo"));
headers.GetHeader<string> ("Action", ns, (XmlObjectSerializer) null);
}
示例15: ReadHeaders
void ReadHeaders ()
{
if (headers != null)
throw new InvalidOperationException ("XmlReader at headers is already consumed.");
string envNS = Version.Envelope.Namespace;
headers = new MessageHeaders (version, max_headers);
if (reader.LocalName != "Header" || reader.NamespaceURI != envNS)
return;
bool isEmptyHeader = reader.IsEmptyElement;
reader.ReadStartElement ("Header", envNS);
reader.MoveToContent ();
if (isEmptyHeader)
return;
while (!reader.EOF && reader.NodeType != XmlNodeType.EndElement) {
if (reader.NodeType == XmlNodeType.Element)
headers.Add (new MessageHeader.RawMessageHeader (reader, envNS));
else
reader.Skip ();
// FIXME: handle UnderstoodHeaders as well.
reader.MoveToContent ();
}
reader.ReadEndElement ();
reader.MoveToContent ();
}