本文整理汇总了C#中System.ServiceModel.Channels.Message类的典型用法代码示例。如果您正苦于以下问题:C# Message类的具体用法?C# Message怎么用?C# Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Message类属于System.ServiceModel.Channels命名空间,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SecurityHeader
public SecurityHeader(System.ServiceModel.Channels.Message message, string actor, bool mustUnderstand, bool relay, SecurityStandardsManager standardsManager, SecurityAlgorithmSuite algorithmSuite, System.ServiceModel.Description.MessageDirection transferDirection)
{
if (message == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
}
if (actor == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("actor");
}
if (standardsManager == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("standardsManager");
}
if (algorithmSuite == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("algorithmSuite");
}
this.message = message;
this.actor = actor;
this.mustUnderstand = mustUnderstand;
this.relay = relay;
this.standardsManager = standardsManager;
this.algorithmSuite = algorithmSuite;
this.transferDirection = transferDirection;
}
示例2: BeforeSendRequest
/// <summary>
/// Add token message at header to using NHibernate cache
/// </summary>
/// <param name="request"></param>
/// <param name="channel"></param>
/// <returns></returns>
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
//get the extension item that the client may have put in the channel
var item = channel.Extensions.Find<NHibernate2ndLevelCacheBehaviorExtensionItem>();
bool clientWantsToBypass = (item != null && item.BypassNHibernate2ndLevelCache);
if (clientWantsToBypass || IsDefaultBypassNHibernateCache)
{
MessageHeader<bool> mhg = new MessageHeader<bool>(true);
MessageHeader untyped = mhg.GetUntypedHeader("token", "ns");
request.Headers.Add(untyped);
}
return null;
}
示例3: ProcessTrustFeb2005ValidateResponse
/// <summary>
/// Processes a Trust Feb 2005 RSTR/Validate message synchronously.
/// </summary>
/// <param name="message">Incoming Request message.</param>
/// <returns>Message with the serialized response.</returns>
public Message ProcessTrustFeb2005ValidateResponse(Message message)
{
return ProcessCore(message,
_securityTokenServiceConfiguration.WSTrustFeb2005RequestSerializer,
_securityTokenServiceConfiguration.WSTrustFeb2005ResponseSerializer,
WSTrustFeb2005Constants.Actions.ValidateResponse,
WSTrustFeb2005Constants.Actions.ValidateResponse,
WSTrustFeb2005Constants.NamespaceURI);
}
示例4: ProcessTrust13RenewResponse
/// <summary>
/// Processes a Trust 1.3 RSTR/Renew message synchronously.
/// </summary>
/// <param name="message">Incoming Request message.</param>
/// <returns>Message with the serialized response.</returns>
public Message ProcessTrust13RenewResponse(Message message)
{
return ProcessCore(message,
_securityTokenServiceConfiguration.WSTrust13RequestSerializer,
_securityTokenServiceConfiguration.WSTrust13ResponseSerializer,
WSTrust13Constants.Actions.RenewResponse,
WSTrust13Constants.Actions.RenewFinalResponse,
WSTrust13Constants.NamespaceURI);
}
示例5: BeginProcessCore
/// <summary>
/// Handles Asynchronous call to the STS.
/// </summary>
/// <param name="requestMessage">Incoming Request message.</param>
/// <param name="requestSerializer">Trust Request Serializer.</param>
/// <param name="responseSerializer">Trust Response Serializer.</param>
/// <param name="requestAction">Request SOAP action.</param>
/// <param name="responseAction">Response SOAP action.</param>
/// <param name="trustNamespace">Namespace URI of the trust version of the incoming request.</param>
/// <param name="callback">Callback that gets invoked when the Asynchronous call ends.</param>
/// <param name="state">state information of the Asynchronous call.</param>
/// <returns>IAsyncResult that should be passed back to the End method to complete the Asynchronous call.</returns>
/// <exception cref="ArgumentNullException">One of the argument is null.</exception>
protected virtual IAsyncResult BeginProcessCore(Message requestMessage, WSTrustRequestSerializer requestSerializer, WSTrustResponseSerializer responseSerializer, string requestAction, string responseAction, string trustNamespace, AsyncCallback callback, object state)
{
if (requestMessage == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("request");
}
if (requestSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestSerializer");
}
if (responseSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("responseSerializer");
}
if (String.IsNullOrEmpty(requestAction))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestAction");
}
if (String.IsNullOrEmpty(responseAction))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("responseAction");
}
if (String.IsNullOrEmpty(trustNamespace))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("trustNamespace");
}
IAsyncResult result = null;
try
{
Fx.Assert(OperationContext.Current != null, "");
Fx.Assert(OperationContext.Current.RequestContext != null, "");
//
// Create the Serialization and Dispatch context objects.
//
WSTrustSerializationContext serializationContext = CreateSerializationContext();
DispatchContext dispatchContext = CreateDispatchContext(requestMessage,
requestAction,
responseAction,
trustNamespace,
requestSerializer,
responseSerializer,
serializationContext);
//
// Validate the dispatch context.
//
ValidateDispatchContext(dispatchContext);
//
// Dispatch the message asynchronously.
//
result = new ProcessCoreAsyncResult(this,
dispatchContext,
OperationContext.Current.RequestContext.RequestMessage.Version,
responseSerializer,
serializationContext,
callback,
state);
}
catch (Exception ex)
{
if (!HandleException(ex, trustNamespace, requestAction, requestMessage.Version.Envelope))
{
throw;
}
}
return result;
}
示例6: CreateDispatchContext
/// <summary>
/// Creates a <see cref="DispatchContext"/> object for use by the <see cref="DispatchRequest"/> method.
/// </summary>
/// <param name="requestMessage">The incoming request message.</param>
/// <param name="requestAction">The SOAP action of the request.</param>
/// <param name="responseAction">The default SOAP action of the response.</param>
/// <param name="trustNamespace">Namespace URI of the trust version of the incoming request.</param>
/// <param name="requestSerializer">The <see cref="WSTrustRequestSerializer"/> used to deserialize
/// incoming RST messages.</param>
/// <param name="responseSerializer">The <see cref="WSTrustResponseSerializer"/> used to deserialize
/// incoming RSTR messages.</param>
/// <param name="serializationContext">The <see cref="WSTrustSerializationContext"/> to use
/// when deserializing incoming messages.</param>
/// <returns>A <see cref="DispatchContext"/> object.</returns>
protected virtual DispatchContext CreateDispatchContext(Message requestMessage,
string requestAction,
string responseAction,
string trustNamespace,
WSTrustRequestSerializer requestSerializer,
WSTrustResponseSerializer responseSerializer,
WSTrustSerializationContext serializationContext)
{
DispatchContext dispatchContext = new DispatchContext()
{
Principal = OperationContext.Current.ClaimsPrincipal as ClaimsPrincipal,
RequestAction = requestAction,
ResponseAction = responseAction,
TrustNamespace = trustNamespace
};
XmlReader requestBodyReader = requestMessage.GetReaderAtBodyContents();
//
// Take a peek at the request with the serializers to figure out if this is a standard incoming
// RST or if this is an instance of a challenge-response style message pattern where an RSTR comes in.
//
if (requestSerializer.CanRead(requestBodyReader))
{
dispatchContext.RequestMessage = requestSerializer.ReadXml(requestBodyReader, serializationContext);
}
else if (responseSerializer.CanRead(requestBodyReader))
{
dispatchContext.RequestMessage = responseSerializer.ReadXml(requestBodyReader, serializationContext);
}
else
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
new InvalidRequestException(SR.GetString(SR.ID3114)));
}
//
// CAUTION: Don't create the STS until after the RST or RSTR is deserialized or the test team
// has major infrastructure problems.
//
dispatchContext.SecurityTokenService = CreateSTS();
return dispatchContext;
}
示例7: ProcessCore
/// <summary>
/// Handles Synchronous calls to the STS.
/// </summary>
/// <param name="requestMessage">Incoming Request message.</param>
/// <param name="requestSerializer">Trust Request Serializer.</param>
/// <param name="responseSerializer">Trust Response Serializer.</param>
/// <param name="requestAction">Request SOAP action.</param>
/// <param name="responseAction">Response SOAP action.</param>
/// <param name="trustNamespace">Namespace URI of the trust version of the incoming request.</param>
/// <returns>Response message that contains the serialized RSTR.</returns>
/// <exception cref="ArgumentNullException">One of the argument is null.</exception>
protected virtual Message ProcessCore(Message requestMessage, WSTrustRequestSerializer requestSerializer, WSTrustResponseSerializer responseSerializer, string requestAction, string responseAction, string trustNamespace)
{
if (requestMessage == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestMessage");
}
if (requestSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestSerializer");
}
if (responseSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("responseSerializer");
}
if (String.IsNullOrEmpty(requestAction))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestAction");
}
if (String.IsNullOrEmpty(responseAction))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("responseAction");
}
if (String.IsNullOrEmpty(trustNamespace))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("trustNamespace");
}
Message response = null;
try
{
Fx.Assert(OperationContext.Current != null, "");
Fx.Assert(OperationContext.Current.RequestContext != null, "");
//
// Create the Serialization and Dispatch context objects.
//
WSTrustSerializationContext serializationContext = CreateSerializationContext();
DispatchContext dispatchContext = CreateDispatchContext(requestMessage,
requestAction,
responseAction,
trustNamespace,
requestSerializer,
responseSerializer,
serializationContext);
//
// Validate the dispatch context.
//
ValidateDispatchContext(dispatchContext);
//
// Dispatch the STS message.
//
DispatchRequest(dispatchContext);
//
// Create the response Message object with the appropriate action.
//
response = Message.CreateMessage(OperationContext.Current.RequestContext.RequestMessage.Version,
dispatchContext.ResponseAction,
new WSTrustResponseBodyWriter(dispatchContext.ResponseMessage, responseSerializer, serializationContext));
}
catch (Exception ex)
{
if (!HandleException(ex, trustNamespace, requestAction, requestMessage.Version.Envelope))
{
throw;
}
}
return response;
}
示例8: MessageTraceRecord
internal MessageTraceRecord(System.ServiceModel.Channels.Message message)
{
this.message = message;
}
示例9: Foo
public void Foo (SMMessage msg, string s)
{
}
示例10: AfterReceiveReply
public void AfterReceiveReply(ref Message reply, object correlationState)
{
}
示例11: AsyncMetadataReferenceRetriever
internal AsyncMetadataReferenceRetriever(IMetadataExchange metadataClient, MessageVersion messageVersion, TimeoutHelper timeoutHelper, AsyncCallback callback, object state) : base(callback, state)
{
this.message = MetadataExchangeClient.MetadataReferenceRetriever.CreateGetMessage(messageVersion);
((IClientChannel) metadataClient).OperationTimeout = timeoutHelper.RemainingTime();
IAsyncResult result = metadataClient.BeginGet(this.message, Fx.ThunkCallback(new AsyncCallback(this.RequestCallback)), metadataClient);
if (result.CompletedSynchronously)
{
this.HandleResult(result);
base.Complete(true);
}
}
示例12: Get
public static MsmqIntegrationMessageProperty Get (SMessage message)
{
throw new NotImplementedException ();
}
示例13: Get
public SMMessage Get (SMMessage req) {
return null;
}
示例14: BeginTrust13Validate
/// <summary>
/// Processes an Asynchronous call to Trust 1.3 Validate message.
/// </summary>
/// <param name="request">Incoming Request message.</param>
/// <param name="callback">Callback to be invoked when the Asynchronous operation ends.</param>
/// <param name="state">Asynchronous state.</param>
/// <returns>IAsyncResult that should be passed back to the End method to complete the Asynchronous call.</returns>
public IAsyncResult BeginTrust13Validate(Message request, AsyncCallback callback, object state)
{
return BeginProcessCore(request, _securityTokenServiceConfiguration.WSTrust13RequestSerializer, _securityTokenServiceConfiguration.WSTrust13ResponseSerializer, WSTrust13Constants.Actions.Validate, WSTrust13Constants.Actions.ValidateFinalResponse, WSTrust13Constants.NamespaceURI, callback, state);
}
示例15: Init
internal void Init(System.ServiceModel.Channels.Message msg, int countMax, XmlSpace space, bool includeBody, bool atomize)
{
this.counter = this;
this.nodeCount = countMax;
this.nodeCountMax = countMax;
this.dom = this;
this.location = 1;
this.specialParent = 0;
this.includeBody = includeBody;
this.message = msg;
this.headers = msg.Headers;
this.space = space;
this.atomize = false;
int num = (msg.Headers.Count + 6) + 1;
if ((this.nodes == null) || (this.nodes.Length < num))
{
this.nodes = new Node[num + 50];
}
else
{
Array.Clear(this.nodes, 1, this.nextFreeIndex - 1);
}
this.bodyIndex = num - 1;
this.nextFreeIndex = num;
Array.Copy(BlankDom, this.nodes, 6);
string str = msg.Version.Envelope.Namespace;
this.nodes[2].ns = str;
this.nodes[3].val = str;
this.nodes[5].ns = str;
this.nodes[5].nextSibling = this.bodyIndex;
this.nodes[5].firstChild = (this.bodyIndex != 6) ? 6 : 0;
if (msg.Headers.Count > 0)
{
int index = 6;
for (int i = 0; i < msg.Headers.Count; i++)
{
this.nodes[index].type = XPathNodeType.Element;
this.nodes[index].parent = 5;
this.nodes[index].nextSibling = index + 1;
this.nodes[index].prevSibling = index - 1;
MessageHeaderInfo info = msg.Headers[i];
this.nodes[index].ns = info.Namespace;
this.nodes[index].name = info.Name;
this.nodes[index].firstChild = -1;
index++;
}
this.nodes[6].prevSibling = 0;
this.nodes[this.bodyIndex - 1].nextSibling = 0;
}
this.nodes[this.bodyIndex].type = XPathNodeType.Element;
this.nodes[this.bodyIndex].prefix = "s";
this.nodes[this.bodyIndex].ns = str;
this.nodes[this.bodyIndex].name = "Body";
this.nodes[this.bodyIndex].parent = 2;
this.nodes[this.bodyIndex].prevSibling = 5;
this.nodes[this.bodyIndex].firstNamespace = 3;
this.nodes[this.bodyIndex].firstChild = -1;
if (atomize)
{
this.Atomize();
}
}