ISendMessageCallback Interface

ISendMessageCallback Interface

.NET Framework (current version)
 

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

Namespace:   System.ServiceModel.Activities
Assembly:  System.ServiceModel.Activities (in System.ServiceModel.Activities.dll)

public interface class ISendMessageCallback

NameDescription
System_CAPS_pubmethodOnSendMessage(OperationContext^)

Executed when a service message is sent.

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
Available since 4.0
Return to top
Show:
© 2016 Microsoft