VB .NET 3.5 Win Forms アプリケーションから Web サービスを呼び出そうとしています。サービス参照を作成できましたが、Web サービスを呼び出すと、SOAP エラーが発生します。
A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.
Web サービスは、証明書によるユーザー名とパスワード認証を使用します。また、環境 (開発または運用) に応じて異なる URL に接続する必要があります。これらの理由から、コードで作成された WSHttpBinding を使用しようとしていました。ただし、バインディングのタイプは SOAP 1.2 を想定しているようです。Web サービスの作成者から、SOAP 1.2 をサポートできないと言われました。
コード内の WSHttpBinding または CustomBinding を使用して、WCF サービス リファレンスを使用して SOAP 1.1 のみをサポートする Web サービスを使用する方法はありますか?
Dim binding As New System.ServiceModel.WSHttpBinding
binding.Security.Mode = ServiceModel.SecurityMode.Transport
binding.Security.Transport.ClientCredentialType = ServiceModel.HttpClientCredentialType.Basic
Dim service As New ServiceReference.ServiceClient(binding, New System.ServiceModel.EndpointAddress(baseUrl))
service.ClientCredentials.UserName.UserName = serviceUsername
service.ClientCredentials.UserName.Password = servicePassword
どんな助けでも大歓迎です!