See If you can't connect to the App Store, iTunes Store, or other Apple services https://support.apple.com/en-us/HT201400. There have been quite a few Apple server connection problems lately. Among other things, in the above document, see Check Apple’s System Status page. You can check there to see if the needed server is available when you need to use one.
And, given the recent connection problems, I suggest you use my search link in trying to solve your problem unable to connect to apple server. You will see a number of links that are, or may be, related to your problem. But, I have not seen a definitive solution for it.
If you want to contact Apple Support to deal with your problem, see:
Get a call from Apple support to help solve your problem using this link https://getsupport.apple.com/?caller=kbase&PGF=PGF63005&category_id=SC0245&symptom_id=23362
Apple ID Support https://support.apple.com/apple-id
Apple Support Twitte rhttps://twitter.com/AppleSupport
Apple ID account security for country-specific and region-specific help https://support.apple.com/en-us/HT204169
Get Support: We’re here to help https://getsupport.apple.com/. Go through the options to find the best one.