HTTP-запрос не авторизован с помощью схемы аутентификации клиента «Anonymous».Заголовок аутентификации, полученный от сервера, был в сети - PullRequest
0 голосов
/ 03 марта 2019

Я использую веб-службу First Data Global Gateway версии 27 для обработки транзакций по кредитным картам в веб-приложении.Когда я отправляю запрос в сервис, я сталкиваюсь с этой проблемой: «HTTP-запрос не авторизован с помощью схемы аутентификации клиента« Аноним ». Полученный с сервера заголовок аутентификации был« »

Ниже приведен мой код

ServiceReference1.ServiceSoapClient ws = new ServiceReference1.ServiceSoapClient();
            ServiceReference1.Transaction transaction = new ServiceReference1.Transaction();
            transaction.ExactID = "******-**";
            transaction.Password = "********";
            transaction.Transaction_Type = "01";   ///"01" to authorize only
            transaction.Card_Number = "****************";
            transaction.CardHoldersName = "*****";
            transaction.DollarAmount = amount.ToString("F2");
            transaction.Expiry_Date = "1030";
            transaction.CVD_Presence_Ind = "1";
            transaction.Transaction_Tag = "Payment";
            string authorizationNum = string.Empty;
            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                ServiceReference1.TransactionResult result = ws.SendAndCommit(transaction);
                if (!result.Transaction_Approved || result.Transaction_Error)
                {
                    return ("There was an error processing your credit card payment");
                }
                else
                {
                    return authorizationNum = result.Authorization_Num + "," + result.Transaction_Tag;

                }
            }
            catch(Exception exception)
            {
                return ("There was an error processing your credit card payment");
                throw;
            }

Ниже приведен код веб-конфигурации

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ServiceSoap">
          <security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
    <message clientCredentialType="Certificate" algorithmSuite="Default" />
  </security> 
        </binding>
        <binding name="ServiceSoap1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://api.demo.globalgatewaye4.firstdata.com/transaction/v27"
        binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
        contract="ServiceReference1.ServiceSoap" name="ServiceSoap" />
    </client>
  </system.serviceModel>
...