Currently i am working on web services in CXF framework. And I have seen many web services with annotations. I am bit confused with the use of annotations in web services. For what i have read, I feel that these annotations are for the other tools, for examples to generate WSDL file from java class file or to create client stubs etc.
If i have web services and i am writing my client, so do I require these annotations in my web service?
Please correct me if something is not correct.
If possible please provide me any link which will describe it in deatil.
The annotations are part of the JAX-WS API, and are used for implementing the service. If you're implementing the client then you needn't be concerned about them (in fact, you needn't even look at the source code of the service).
The webservice "without using Annotations", are implemented using JAX-RPC. There developer need to develop configuration file, run wscompile for WSDL & mapping, modify web.xml and implement webservices.xml (if not generating thru WSDL2Java). Also develop SEI. Although this all is simple but redundant for a webservice.
With JAX-WS "webervie using Annotations", you just need to give annotations in your implementation bean and deploy. Thats it!. All your deployment descriptors, WSDL etc will get automatically generated.
See the annotations are not the mandatory to follow you can do it through xml configuration also. But annotation will help you as below: 1. no need to write xml files. 2. no need to write xtra coding or java files. 3. reduce code size 4. increase code clarity. 5. decrease development time etc..
Annotations doesn't change the meaning of the semantics of the program, but they just tell to the other tools or libraries to process the element in special way.
I guess we could argue what the "semantics of the program" are, but I'd say that statement is incorrect both generally, and specifically for JAX-WS.
As regards JAX-WS, if a regular POJO is annotated with @WebService, it suddenly gets exposed to whatever machine can get reach the host server (possibly the whole world). That has the potential to alter the characteristics of the code executing in that JVM dramatically.
More generally I could annotate a method with something that causes the method always to add 1 to the result it returns. That is a definite change in semantics. It's not just outside tools/frameworks that have access to annotations - code is free to inspect its own annotations. That goes with the trend to use annotations for domain-specific functionality (as opposed to code-specific functionality, which is what we are talking about here). [ July 18, 2008: Message edited by: Ulf Dittmer ]
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop