阴山
In 625, Eastern Tujue's Jiali Khan Ashina Duobi attacked Ling Prefecture (靈州, roughly modern Yinchuan, Ningxia). Emperor Gaozu sent the general Zhang Jin (張瑾) to resist Ashina Duobi, with Wen serving as Zhang's secretary general. When Zhang engaged Ashina Duobi, however, he suffered a major defeat, and Wen was captured. As Wen was an important official, Ashina Duobi put him under interrogation and asked him about the strengths and weaknesses of the Tang state. Wen refused to answer, and Ashina Duobi moved him to the Yin Mountains region.