I am trying to access a Soap webservice (HTTP) which requires authentication.I am using WCF to consume the service. I am getting error Message as The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm="weblogic"'.
Any help is appreciated, thank you.
This is what my code looks like:
var binding = new BasicHttpBinding();
binding.MaxBufferSize = 2147483647;
binding.MaxReceivedMessageSize = 2147483647;
binding.Security = new BasicHttpSecurity
{
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
Transport = new HttpTransportSecurity()
{
ClientCredentialType = HttpClientCredentialType.Basic
}
};
var endpoint = new System.ServiceModel.EndpointAddress(configuration["webserviceAddres"]);
servicio = new ConsultaMontosOperadosFondosClient(binding, endpoint);
servicio.ClientCredentials.UserName.Password = MyPass;
servicio.ClientCredentials.UserName.UserName = MyUser;
If the service is not over https, then try adding the realm: (I am not sure it is weblogic or not, just going by what you posted in your error)