Conversion of formamide to isocyanide
Just like phosgene or phosphorus oxychloride, p-TsCl is acting as a dehydrating agent. Its affinity for oxygen atoms is fairly apparent when you consider its common use as an alcohol protecting agent. The mechanism is as follows:

$\hspace{2.6cm}$