*
The moose likes Web Services and the fly likes WebService and WebServiceClient Annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WebService and WebServiceClient Annotations" Watch "WebService and WebServiceClient Annotations" New topic
Author

WebService and WebServiceClient Annotations

Esteban Puertas
Greenhorn

Joined: Mar 23, 2008
Posts: 22
Hi,
I am new to web services. Can someone explain me please what does the WebService and WebServiceClient annotations really do behind the scenes ? Does the container adds some AOP code (or something like that) whenever an instance of the annotated class is created ?

Thanks for any reply :-)
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
It's nothing that fancy.

There isn't a container - however the service provider requires an HTTP server (Java SE 6 comes with com.sun.net.httpserver.HttpServer).
And it isn't AOP.

The annotations basically provide binding hints for code generators like wsgen (for a Java SE 6 web service) and wsimport (for a Java SE 6 web service client).

Look at this for an example.

See also
Starting Out
Basic doubts in Web services
Esteban Puertas
Greenhorn

Joined: Mar 23, 2008
Posts: 22
Thank you for replying :-)
Now it is more clear form me... wsgen uses the @WebService annotation for creating all the required classes for web service deployment, and invocation.
But there is still something I don't understand... why wsimport (that reads the wsdl and generates the required classes) adds annotations to the code ? who is going to use them ?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Esteban Puertas:
why wsimport (that reads the wsdl and generates the required classes) adds annotations to the code ? who is going to use them ?


It is there to differentiate the generated code from the developer code. It documents the relationship between the WSDL and the generated code in such a way that an IDE can use them to navigate between the code and the WSDL and correlate between the WSDL fragments and the code artifacts.

See JSR-000224 JavaTM API for XML-Based Web Services (JAX-WS) 2.0 specification; 7.5 javax.xml.ws.WebServiceClient and 7.6 javax.xml.ws.WebEndpoint.

Also 3.7 javax.xml.ws.WebServiceClient.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: WebService and WebServiceClient Annotations
 
Similar Threads
Enabling WS Security for XML Encryption of an EJB Web Service
Servlet Exception handling not working
Response Contained No Data Exception
Java cookbook : reader question
Creating List/Array of Managed Beans