Oscillatory motions of solitons in finite inhomogeneous structures