Hi,
You may find a lots of help from SCN and help.sap.com by using a simple search.
To start with here are few url's which would help you.
http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=79954137
How to Create User-Defined Function for Message Mapping Using NWDS
User-Defined Functions - Managing Services in the Enterprise Services Repository - SAP Library
Thanks,
Sudhansu