Passing parameters to java service

I would like to create java function in Web methods, so that i can pass parameters and i want to return some values. what i want to do is i would like to call that function from java service.

how to create such a function.

please help me out.

I found myself. i need to put that code in shared section.