See this link for the biography of Pius IX, born in 1792. As for sure he didn't serve as a soldier.
Cheers
Marc