Perturbative solution of the motion of an asteroid in resonance with Jupiter