i'm trying to call a soap api but i can't authenticate. The api should recive an xml like this in the header:
<wsse:Security> <wsse:UsernameToken> <wsse:Username>XXXXXXXXX</Username> <wsse:Password>XXXXXXXXX</Password> </wsse:UsernameToken> </wsse:Security> But i don't understand how to pass it, i'm trying to insert the credential in this way:
client.ClientCredentials.UserName.UserName = "XXXXXXXXX"; client.ClientCredentials.UserName.Password = "XXXXXXXXX"; And then build the binder in this way:
BasicHttpsBinding bindingHttps = new BasicHttpsBinding(); bindingHttps.Security.Mode = BasicHttpsSecurityMode.Transport; bindingHttps.MaxReceivedMessageSize = 500000000; bindingHttps.SendTimeout = new TimeSpan(0, 5, 0); But the call return this error: System.AggregateException: 'One or more errors occurred. (Error: UsernameToken not present)'