I wrote a flat file gateway service that sets the TN_parms and calls the routeFlatFile. I had two issues here. One is that some times only 0 bytes of the flat file are getting persisted to TN. Now lately a new error of type stream indexoutofbounds exception is occuring during the recognition stage.
Make sure in the routeFlatFile you have to map stream object (flatfile data)using bytesToStream ,along with TN_Params this will persist in TN and accomplish the work.