WCF - Switching Company and Plant

Does anyone know how I can switch company and plant using WCF? I see there’s a SessionMod.svc, but I can’t seem to get it to do the switch with this:

        using (SessionModSvc.SessionModSvcContractClient client = new SessionModSvc.SessionModSvcContractClient())
        {
            client.ClientCredentials.UserName.UserName = "manager";
            client.ClientCredentials.UserName.Password = "manager";

            string strTemp = "";
            client.SetCompany("Company2", out strTemp, out strTemp, out strTemp, out strTemp, out strTemp, out strTemp, out strTemp, out strTemp);

            client.SetPlant("Plant2");
            cient.Login();

            client.Logout();
        }

What am I doing wrong?

You need to pass in a CallContext header. (That’s the easiest way)
Instantiate this puppy

using System.Runtime.Serialization;
public interface ICallHeader
{
string Name { get; }
 
string Namespace { get; }
}
 
[DataContract]
public class CallSettings : ICallHeader
{
private CallSettings()
{
}
 
public CallSettings(string company, string plant, string language, string formatCulture)
{
this.Company = company;
this.Plant = plant;
this.Language = language;
this.FormatCulture = formatCulture;
}
 
[DataMember]
public string Company { get; set; }
 
[DataMember]
public string FormatCulture { get; set; }
 
[DataMember]
public string Language { get; set; }
 
public string Name =>
"CallSettings";
 
public string Namespace =>
"urn:epic:headers:CallSettings";
 
[DataMember]
public string Plant { get; set; }
 
[DataMember]
public short? TimezoneOffset { get; set; }
}

And pass it in as a header. With the Key of “CallSettings”