Anonomous Accessがオフになっていて、Windows認証がオンになっているWCFWebサービスに接続しています。web.configファイルには、ユーザーを許可し、users = "?"を拒否するためのローカルユーザーアカウントがあります。
サービスプロキシを正常にダウンロードして生成できますが(クレデンシャルの入力を求められます)、Windowsフォームプロジェクトから(クレデンシャルを渡した場合でも)、次のエラーが発生します。
System.ServiceModel.Security.MessageSecurityException was unhandled
Message="The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm=\"SEIPART001\"'."
Message="The remote server returned an error: (401) Unauthorized."
これが私のサンプルコードです:
ip.eIPCShoppingCartWSSoapClient client = new iParts.ip.eIPCShoppingCartWSSoapClient();
System.Net.NetworkCredential creds = new System.Net.NetworkCredential("username", "password", "domain");
client.ClientCredentials.Windows.ClientCredential = creds;
iParts.ip.OrderListItem[] listItem = client.GetOrderList("1234"); //throws exception here