Q:

how can i implement Web Service Security?

I am new to web service, I am done with a web service and created a client based on wsdl of that web service. How can I implement security to the web service so that it will be secured or authenticate?
I googled and got: to add policy annotation in my web service class which will have the name of my associating policy file name. What is this associating policy file or .xml file and how it can be done?
please help

A:

For this you need to use rampart module provided by apache foundation. Therre is something called UsernameToken that you can implement, so that when a a client tries to access the webservice, he needs to provide the user name and password in the password callback method. In the server side also, the password callback method is going to be invoked. There we can verify the received user name and password, and depending on its success or failure, you can either allow the web service to be invoked or throw an exception specifying the reason of failure. It's quite easy. You first download rampart module from apache foundation, and then study the samples given in that archive file. 
Best Of Luck

