I am consuming a wsdl described as :
<wsdl:binding name="PassengerConformance_v1Binding"
type="tns:PassengerConformanceAuthenticationPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="identify">
</wsdl:operation>
</wsdl:binding>
But the request getting generated is UTF16, which the server wants to be utf-8 This is how my code looks
var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
{
Security = new BasicHttpSecurity
{
Mode = BasicHttpSecurityMode.Transport,
Transport = new HttpTransportSecurity
{
ClientCredentialType = HttpClientCredentialType.Digest
}
}
};
var address = new EndpointAddress(dcsServiceConfiguration.Url);
var channel = new ChannelFactory<T>(binding, address);
channel.Credentials.HttpDigest.ClientCredential =
new NetworkCredential(username, Password);
var buildDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var filePath = buildDir + @"\ClientCert.pfx";
channel.Credentials.ClientCertificate.Certificate =
new X509Certificate2(filePath, "password", X509KeyStorageFlags.MachineKeySet);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
return channel;
I understand that BasicHttpBinding deafult textEncoding value is utf-8, but still when I check in the message inspector, it comes to be utf-16.
I noticed that when I replicated this code in .net 7.2 framework consoel app, there was no xml tag. which would still work for me Please help.