Loknadh,
The trigger invoking custom service which you have created should have the service input of your published document(ex:purchaseorder xml) which you have published to broker.
Then in the custom service incorporate the logic of mapping the publish document(purchaseorder xml) to Flat File.(For debugging put the savepipeline/restorepipeline as the first steps in your flow and check the pipe if you are getting the published document or not)
As a last alternative:
If your custom service input not getting publish document then give the service input as(fully qualified document name say PurchaseOrder::Document::POXML).
HTH.
#Integration-Server-and-ESB#webMethods#Adapters-and-E-Standards