File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Doubt in  @Webmethod annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Doubt in  @Webmethod annotation" Watch "Doubt in  @Webmethod annotation" New topic

Doubt in @Webmethod annotation

Ankur Tewary

Joined: Mar 01, 2012
Posts: 1
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

Joined: Oct 04, 2006
Posts: 2198
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!

My free books and tutorials:
I agree. Here's the link:
subject: Doubt in @Webmethod annotation
It's not a secret anymore!