Motion of domain walls under the action of spin-polarized current in a magnetic junction