Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WebService and WebServiceClient Annotations

 
Esteban Puertas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic