I'm relatively new to web services. I dont know how this web service will work. I didn't find any useful simple example of a web service by googling. Can any one please give me some tips or links to creating a web service using java.
If you use Spring, their web service module is a great way to create "contract first" web services.
you could create a simple embeddable web-service using atmosphere framework. Atmosphere spade server supports jersey and has an embedded webserver called atmosphere spadeserver.
You should take a look at Apache Axis implementing SOAP protocol, which plays a key role in web services. The messages being exchanged are soap messages having header with some metadata and body with the actual xml message. You will need also Apache Tomcat, Eclipse and its axis plugin to run this brilliant example .
I recommend Restlet for RESTful style web service. It allows you to support different representations, to be specific, it could pass or return the result in various kind of formats, such as JSON, XML, Plain Text, etc. Here is the link to download:
Restlet and Original Paper if you are interested in more.