با سلام

بنده هنگام فراخوانی وب سرویس و تست آن خطای ران تایم The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm="weblogic"'. رو می گیرم.

نام کاربری و پسورد رو روی basic authentication بر روی header تنظیم کردم. البته دلیل این کار به خاطر این بود که ارائه دهنده وب سرویس گفته بود باید این کار رو انجام بدم.

ممنون میشم کمکم کنید و بگین چکار کنم برای رفع این مشکل؟

کد رو هم در زیر گذاشتم:

کد app.config:


<?xml version="1.0" encoding="utf-8" ?><configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="EstelamPortBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
bypassProxyOnLocal="false" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" useDefaultWebProxy="true">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="weblogic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://10.0.233.254:80/sabteahval/proxy/SabteAhvalPS"
binding="basicHttpBinding" bindingConfiguration="EstelamPortBinding"
contract="SabtAhvalService.EstelamPort" name="EstelamPort" />
</client>
</system.serviceModel>
</configuration>


کد سی شارپ:

public static getEstelam3Response GetPersonsInfo(ParameterInfo info)        {
EstelamPortClient client = new EstelamPortClient();
PersonInfo person = new PersonInfo
{
nin = info.NationalityCode,
birthDate = info.BirthDate,
name = new byte[] { },
family = new byte[] { },
shenasnameSeri = new byte[] { },
fatherName = new byte[] { },
officeName = new byte[] { }
};
client.ClientCredentials.UserName.UserName = "user";
client.ClientCredentials.UserName.Password = "pass";
getEstelam3Response response = client.getEstelam3(new getEstelam3Request(client.ClientCredentials.UserNa me.UserName, client.ClientCredentials.UserName.Password, "36497", "8B174B22F2EA", person));
return response;
}