Analytical Solution of Whispering-Gallery Modes