Context flow across distributed MSE deployment

Topics: Usage Scenarios, Technical Questions
Feb 11, 2009 at 10:46 AM
I'm looking for a way to flow context information through MSE. Say I have an endpoint policy that generates some information (for instance the credential the client used) and I have a channel policy that want to pickup that information (for instance for impersonating the client in the call to the actual service).

The question is where should I place this context data? Can I use the WCF OperationContext (or some other WCF context object)? Should I add custom headers to the message and store the context data in the message itself? What is are the pro and cons of each option with regard to a distributed MSE deployment (Messenger and Broker are not on the same machine)?

Any feedback would be most welcome.

Thanx,
Marc Jacobi
Developer
Feb 11, 2009 at 3:02 PM
In a distributed Messenger-Broker topology, you'll need to inject any context you want to flow between the two into the message itself... typically a message header.  Then if necessary strip off this context at the Broker before the message is dispatched to the service implementation.  The format of the messages flowing between Messenger and Broker is normalized to Soap12 Addressing 10, regardless of the format accepted at the endpoint or format required at the service implementation.  So you'll always be able to add a custom message header at the Messenger and then pull it off at the Broker.

The Security guide has some behaviors that flow UserNameTokens from the endpoint to the service implementation.  However, these behaviors store the captured security token as an IPrincipal which won't flow between a distributed Messenger and Broker.  If you look at the source code for these behaviors though, it should give you the steps to capture and replay the security token, you'll just need to push them into a message header instead.