Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Studying annotation rules

 
Victor Skvorzkoff
Greenhorn
Posts: 10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Would anybody kindly suggest a way to study rules for web service annotations? For example, I am currently studying @WebServiceRef annotation. I created a web service and a servlet in which I am using @WebServiceRef to inject reference to that service and "play around" with "type" and "value" elements of this annotation, remove them, add them, add "name" element to see what happens and so on. However, I think there is a more efficient way to study this. My objective in this exercise is to gain better understanding of rules like these:

When the @WebServiceRef annotation is defined on the class:
- the value element must be present
- the type element must be present
- the name element must be present (there is no default name;  this name is used when doing a lookup: “java:comp/env/<name>”)

When the @WebServiceRef is defined on a (field) property and refers to a generated service type (e.g. public class LogWebService extends Service )
- the value element must not be present
- the type element may be present

and so on.

I guess I could try to just memorize these rules but I'd like to understand the reasons why, for example, "value" element is present in one case and not the other. Could anybody suggest a material that explains the reasons why @WebServiceRef elements like "value", "type", "name" must be used or not?

Thanks,
Victor.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2534
113
Android Chrome Eclipse IDE
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anybody suggest a material that explains the reasons why @WebServiceRef elements like "value", "type", "name" must be used or not?

I haven't found any material like that.

I agree with you, the specifications often specify without explanations. It would be of great value when they add this to some difficult to grasp parts of the spec.
 
Victor Skvorzkoff
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits Walraven wrote:
Could anybody suggest a material that explains the reasons why @WebServiceRef elements like "value", "type", "name" must be used or not?

I haven't found any material like that.

I agree with you, the specifications often specify without explanations. It would be of great value when they add this to some difficult to grasp parts of the spec.


Hi,

Actually, I found some of the previous comments on this issue helpful. Such as:

http://www.coderanch.com/t/627451/java-Web-Services-OCEJWSD/certification/WebServiceRef-type-WebServiceRef

The key to understanding is to figure out what is being "inferred" when using this annotation.

Thanks,
Victor.
 
Victor Skvorzkoff
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, I think I narrowed down the rules when "value" and "type" are present (or absent). Could somebody please confirm these assumptions:

with @WebServiceRef annotation:

value: is never present when service type can be inferred. Otherwise, value must always be present.
type: is always optional in the case when SEI is implemented. Otherwise, type must not be present.

Would that be a correct summary?

Thanks,
Victor.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic