Implement BeforeSendRequest Method to Validate Outbound Messages on the Client

- J.D. Meier, Carlos Farre, Jason Taylor, Prashant Bansode, Steve Gregersen, Madhu Sundararajan, Rob Boucher

If you need to perform validation on client of outbound messages implement the BeforeSendRequest method of the interface IClientMessageInspector of the message inspector. This will validate the message before sending the request to the service and after serialization.

Outbound message validation will be required if you want to validate the message , before sending the request to the service, so you can validate input parameters , message and data contracts in the client.

Following example shows how to implement BeforeSendRequest method.
object IClientMessageInspector.BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
    validateMessage(ref request);
    return null;

Additional Resources

Last edited Jun 12, 2008 at 10:19 PM by prashantbansode, version 1


No comments yet.