It works sometimes when an enemy offers a ceasefire to you. Don´t accept it but make a counter-offer and demand them to become vassals. Offer some money as well. And it is necessary that you are substantially stronger than your opponent. Eventually you´ll have a vassal then. As long as your settlements boardering that vassal are strongly garrisoned the vassalage will remain intact. Avoid diplomatic negotiations with the vassal because in these occasions he may declare an end of the vassalage.