Message Inspector with Custom Behavior and IClientMessageInspector

My goal was to to make a simple MessageInspector so that I can see what message is going out at some point and probably add some info into the headers at the client side. Now the SDK had quite a good sample of the message inspector implementation but I was looking for something like a hello world.

The point is how you tie up following.

1. Add a custom behavior to the proxy endpoint.
[code:c#]proxy.Endpoint.Behaviors.Add(new CustomBehavior());[/code]

2. Add the IClientMessageInspector to the behavior in the ApplyClientBehavior of the custom behavior
[code:c#]behavior.MessageInspectors.Add(new CustomMessageInspector());[/code]

3. Implement the BeforeSendRequest or AfterRecieveReply to get the message

Do provide your inputs on how this can be better used.

Update – Sample