Generation and collapse of Langmuir solitons in a nonuniform plasma