Li Xiaogong
In 617, Xiao Xi, a great-grandson of Emperor Xuan of Western Liang, whom Cen Wenben's grandfather Cen Shanfang had served, rose in rebellion, claiming to restore the Liang dynasty. Xiao Xi established his capital at Jiangling (江陵, in modern Jingzhou, Hubei), and he summoned Cen Wenben to serve as "Zhongshu Shilang" (中書侍郎), the deputy head of the legislative bureau of government (中書省, "Zhongshu Sheng"). Cen was in charge of writing the imperial edicts. In 621, when the Tang dynasty general Li Xiaogong (a nephew of Emperor Gaozu, the founding emperor of the Tang dynasty) attacked Liang and put Jiangling under siege, Cen suggested to Xiao Xi that he surrendered, and Xiao Xi did so. After Xiao Xi's surrender, however, Li Xiaogong's subordinates wanted to pillage the city. Cen persuaded Li Xiaogong that it would be wrong to do so, and Li Xiaogong subsequently ordered against pillaging. As Li Xiaogong was then put in charge of the former Liang capital, he invited Cen to serve on his staff. In 623, when Emperor Gaozu sent Li Xiaogong to attack the rebel leader Fu Gongshi, Cen followed Li Xiaogong and was in charge of his military correspondences. After Li Xiaogong defeated and killed Fu Gongshi and was put in charge of Fu's capital Danyang (丹楊, in modern Nanjing, Jiangsu), Cen continued to serve on Li Xiaogong's staff.