/// <summary>
 /// 调用服务器方法
 /// </summary>
 /// <param name="request"></param>
 /// <param name="channel"></param>
 /// <returns></returns>
 object IClientMessageInspector.BeforeSendRequest(ref Message request, IClientChannel channel)
 {
     if (!string.IsNullOrEmpty(Thread.CurrentPrincipal.Identity.Name))
     {
         UserSoapHeader header = new UserSoapHeader();
         header.Token = Thread.CurrentPrincipal.Identity.Name;
         header.Lan = Thread.CurrentThread.CurrentUICulture.Name;
         request.Headers.Add(header);
     }
     return null;
 }
Exemple #2
0
 public static UserSoapHeader FromReader(XmlDictionaryReader reader)
 {
     UserSoapHeader header = new UserSoapHeader();
     
     while (!reader.EOF)
     {                
         if (reader.Name == "token")
             header.Token = reader.ReadElementContentAsString();
         else if (reader.Name == "lan")
             header.Lan = reader.ReadElementContentAsString();
         else if (reader.Name == "SOAP-ENV:Body")
             break;
         else
             reader.Read();
     }
                
     return header;
 }