客户端身份验证方案“匿名”未授权HTTP请求。从服务器收到的身份验证标头在Web中为“

时间:2019-03-03 10:10:03

标签: web-services authentication wsdl

我正在使用First Data Global Gateway Web服务版本27处理Web应用程序中的信用卡交易。当我向服务发送请求时,我会遇到以下问题:“ HTTP请求未经客户端身份验证方案'Anonymous'的未经授权。从服务器收到的身份验证标头为”

以下是我的代码

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;
            }

以下是Web配置代码

<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>

0 个答案:

没有答案