Unhandled exception when rendering form System.IO.PathTooLongException:
The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.
Some general info about the exception can be found here.
It is caused by the MSO-INFOPATHSOLUTION directive in the head of the xml definition of the form. The attribute HREF of this directive can not exceed the size of 260 characters.
Our InfoPath forms where designed as InfoPath 2003 forms, and the HREF attribute was really long:
but if you strip it down, you can see that a simple link to the file is enough.
The forms designed in InfoPath 2007 do not generate the href attribute that long. Also note if you just want the forms to open in the client application(InfoPath), you can set this on the advanced settings of the Document Library, in which the forms are contained. But even there, if there would be link to the file outside of this library, or if you will access the direct link, SharePoint will always try to open it in Web Browser.
This forum post had led me to the solution: