C#服务请求

时间:2016-06-11 07:03:02

标签: c# web-services

我在c#项目中堆叠Apple GSX Api请求。一切都很好,但我无法得到api的回应 证书已完成,静态IP已列入白名单。

当我请求" https://gsxapiut.apple.com/gsx-ws/services/emea/asp"

时,请返回此错误
  

{"发出HTTP请求时发生错误   https://gsxapiut.apple.com/gsx-ws/services/emea/asp。这可能是应该的   未正确配置服务器证书的事实   在HTTPS情况下使用HTTP.SYS。这也可能是由a引起的   客户端和服务器之间的安全绑定不匹配。"}

请求功能:

 public void Authenticate()
    {
        try
        {
            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;               
            EndpointAddress endpoint = new EndpointAddress("https://gsxapiut.apple.com/gsx-ws/services/emea/asp");               
            var sslCertFilename = "test.p12";
            var sslCertPassword ="xxxxx";
            GsxApi3.GsxWSEmeaAspPortClient service = new GsxApi3.GsxWSEmeaAspPortClient();

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
            service.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2(
               sslCertFilename,
                sslCertPassword, X509KeyStorageFlags.MachineKeySet);

            var auth = new GsxApi3.authenticateRequestType()
            {
                languageCode = "EN",
                serviceAccountNo = "xxxxxxxxx",
                userId = "xxxxxxxxxxx",
                userTimeZone = "CET"
            };

            var session = service.Authenticate(auth);                
            var userSessionId = new GsxApi3.gsxUserSessionType { userSessionId = session.userSessionId };
        }
        catch (Exception err)
        {


        }


    }

0 个答案:

没有答案