I'm trying to build a client in Visual Studio 2019 that will consume a SOAP Service that is protected using an id/pass and cert.
I created a SoapUI project by importing the WSDL and then configured the ws-security settings on the project to have an outgoing signature and imported the keystore that has the cert I want to use. Finally, I set the auth on the request to use Basic, set the id/pass and selected my outgoing signature in the Outgoing WSS drop down. After doing all of this I can call the service perfectly using Soap UI.
In Visual Studio I created a new console project, added a connected service reference using the same WSDL and now I'm trying to write the code. I tried setting the credentials by doing
System.ServiceModel.BasicHttpsBinding myBinding = new System.ServiceModel.BasicHttpsBinding();
System.ServiceModel.EndpointAddress myAddress = new System.ServiceModel.EndpointAddress("url");
ServiceReference1.CaseTypeClient myClient = new ServiceReference1.CaseTypeClient(myBinding, myAddress);
myClient.ClientCredentials.UserName.UserName = "ID";
myClient.ClientCredentials.UserName.Password = "Pass";
System.Security.Cryptography.X509Certificates.X509Certificate2 myCert = new System.Security.Cryptography.X509Certificates.X509Certificate2("CertFileName", "CertPass");
myClient.ClientCredentials.ClientCertificate.Certificate = myCert;
However, when I invoke the method I get a soapfault back from the service saying "XmlException: Unbound prefix used in qualified name 'wsse:FailedAuthentication'".
What is the correct way to do what I'm trying to accomplish?