How add cutom header in WCF with dynamic user values to every call?
I am consuming one java webservice with WCF client. I want to pass user related information to service in header. I have aleady gone to through thread How to add a custom header to every WCF calls?
I have implemented IClientMessageInspector
interface with BeforeSendRequest
() method. Now, I want to pass user related information in SOAP header like Oraganization, which may differ for every user. I have all this information in my ASP.net application, whi开发者_Go百科ch uses this service.
Is there anyway I can pass user related information to this BeforeSendRequest
() method from asp.net session and build Message header before sending any request?
There are few options
- Put the information in
Session
and retrieve it inBeforeSendRequest
- Put it in
HttpContext.Current.Items
and retrieve it in `BeforeSendRequest' - Use Thread Local Storage (http://msdn.microsoft.com/en-us/library/6sby1byh.aspx)
精彩评论