Как Добавить свои заголовок WCF клиенту

Мне необходимо добавить заголовки к SOAP-запросу чтобы он выглядил так:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <AuthorizationContext xmlns="http://someMyNameSpace">
      <Identities password="somePassword" login="someLogin" 
        xsi:type="RepositoryIdentity" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    </AuthorizationContext>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     .........
  </s:Body>
</s:Envelope>

Никак не получается чтобы он добавил к Identities тип xsi:type и одно пространство имён

UPD: Сейчас попытался добавить заголовок вручную

using (var wcfService = new MyWcfClient())
{
  using (var scope = new OperationContextScope(wcfService .InnerChannel))
  {

    var header = MessageHeader.CreateHeader(
      "ServiceContext",
      "http://someMyNameSpace",
      new Identities() { password = "somePassword", login = "someLogin" }
    );

    //добавляем заголовки с идентификацией
    OperationContext.Current.OutgoingMessageHeaders.Add(header);

    .....
}

Сам класс заголовка

[SoapInclude(typeof(RepositoryIdentity))]
public class Identities
{
    [XmlAttribute] public string password;
    [XmlAttribute] public string userName;
}

// Производные классы:
public class RepositoryIdentity : Identities { }

Почти то что надо формирует, но зачем-то добавляет пустое простаранство и схему, да и тип не добавил в итоге:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <AuthorizationContext xmlns="http://someMyNameSpace">
      <Identities password="somePassword" login="someLogin" 
        xmlns="" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    </AuthorizationContext>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     .........
  </s:Body>
</s:Envelope>

Ответы (0 шт):