I am trying to connect to a SOAP API using C#. The API I use insists that I need to authenticate each API call with an OAuth Token. I have implemented the OAuth system and got the token I needed, But I am not sure how to Append it to the SOAP Call I am making. So I trid something like this
var soapClient = new ReturnClient();
soapClient.ClientCredentials.UserName.UserName = "MyToken";
soapClient.ClientCredentials.UserName.Password = "MyToken";
var rrr = new RetrieveReturnRequest {RetrieveReturnRequestWrapper = xElem2};
var response = soapClient.RetrieveReturn(rrr);
But this does not works and throws System.ServiceModel.CommunicationException:
. Can anyone pointout what's the correct way to Authenticate a SOAP call with Access Token