This topic has not yet been rated - Rate this topic

ISendMessageCallback Interface

An interface that implements a callback that is called just before a message is sent on the wire by the Send or SendParameters activities.

Namespace:  System.ServiceModel.Activities
Assembly:  System.ServiceModel.Activities (in System.ServiceModel.Activities.dll)
public interface ISendMessageCallback

The ISendMessageCallback type exposes the following members.

  Name Description
Public method OnSendMessage Executed when a service message is sent.
Top

The following example shows how to implement the ISendMessageCallback interface to a a new header to a message before it is sent out on the wire.


class SendInstanceIdCallback : ISendMessageCallback
{
    public const string HeaderName = "InstanceIdHeader";
    public const string HeaderNS = "http://Microsoft.Samples.AccessingOperationContext";

    public Guid InstanceId { get; set; }

    public void OnSendMessage(System.ServiceModel.OperationContext operationContext)
    {
        operationContext.OutgoingMessageHeaders.Add(MessageHeader.CreateHeader(HeaderName, HeaderNS, this.InstanceId));
    }
}


.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ