Tamada Koteswara Rao was posted with Jammu & Kashmir regiment and had come to his native place Baruva on a leave, a Government Railway Police (GRP) official said.
Rao is survived by his wife and two minor sons.
The incident occurred in the morning after Rao left his house to rejoin duty, said Chinna Rao, the GRP official attached to Palasa railway station near Sompeta.
The GRP is investigating the matter to find out cause behind the incident, he said.
A case was registered under section 174 of CrPc (enquiry and report on suicide).