Share via


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.
                      proxy.Endpoint.Behaviors.Add(new CustomBehavior());

2. Add the IClientMessageInspector to the behavior in the ApplyClientBehavior of the custom behavior
                      behavior.MessageInspectors.Add(new CustomMessageInspector());

3. Implement the BeforeSendRequest or AfterRecieveReply to get the message

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

CustomBehavior.zip

Comments

  • Anonymous
    May 15, 2013
    Hi, Can I do this even if I have no control over the service