Solitons and breathers from the third integral of motion in galaxies