Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in @Webmethod annotation

 
Ankur Tewary
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is advised that 'exclude=true' on @Webmethod not to be used if there is an SE Interface Declared. It can be done though and if done, the method is excluded. So, why is it advised so?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
First of all, where have you read such an advice?
If it is in the Java SE API documentation of the annotation, then it only says:
This member-value is not allowed on endpoint interfaces.

Thus, it does not advice against using the @WebMethod annotation, just saying that it is not allowed on interfaces that endpoint implementation classes implement.

A possible reason for recommending not to use the @WebMethod annotation is that there is little reason in declaring a method in an endpoint implementation class public and then annotate it with @WebMethod(exclude="true").
If you have a method that is public in an endpoint implementation class and it is not used in the web service but it is called from another part of the system, then there may be reasons to consider separation of concerns and have two different service implementation classes.
Best wishes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic