This project is read-only.

How to Validate Inbound Messages on a Service

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

Implement the AfterReceiveRequest of the interface IDispatchMessageInspector of a message inspector to validate inbound messages on a service. This allows you to validate the message after the request has arrived but before service operation invocation and deserialization.
object IDispatchMessageInspector.AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
{
    try
    {
        validateMessage(ref request);
    }      
    catch (FaultException e)
    {
        throw new FaultException<string>(e.Message);
    }
    return null;   
}

Additional Resources

Last edited Jun 13, 2008 at 9:10 PM by prashantbansode, version 1

Comments

No comments yet.