Yes. Regardless of the spell's name, Trap the Soul traps a creature's body and/or "life force". Anything that is animated has a life force, and so can be trapped.
The Magic Jar spell in contrast does require creatures to have (or be) a soul, and explicitly excludes mindless undead.