开发者

How add cutom header in WCF with dynamic user values to every call?

开发者 https://www.devze.com 2023-02-15 01:19 出处:网络
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

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

  1. Put the information in Session and retrieve it in BeforeSendRequest
  2. Put it in HttpContext.Current.Items and retrieve it in `BeforeSendRequest'
  3. Use Thread Local Storage (http://msdn.microsoft.com/en-us/library/6sby1byh.aspx)
0

精彩评论

暂无评论...
验证码 换一张
取 消