8

I'm creating a web service in Java EE 6 annotating an enterprise bean with @WebService. I need to expose only some of the bean methods, so I've annotated with @WebMethod only the required ones. Unfortunately JAX-WS ignores the annotations and try to expose all methods. The trouble is that there is one method, that's not intended to be used as a web service operation, that returns an interface and this cannot be managed by JAX-WS, so the web service is not deployed. Is this an expected behavior or am I missing something?

remigio
  • 4,101
  • 1
  • 26
  • 28
  • You can set the visibility of the method to protected ( or language equivalent ) JAX-WS exposes all public methods by default ( which I thoroughly agree with). – Anthony Nov 05 '13 at 01:18

1 Answers1

13

You could add the attribute 'exclude' to the annotation and set it to true. The Javadoc states: Marks a method to NOT be exposed as a web method.

Florian
  • 1,142
  • 1
  • 9
  • 21
  • I just had to press ctrl+space to get annotation parameters and the solution was there! Thanks a lot. – remigio Nov 29 '12 at 16:25
  • but this is not possible in CXF, it throws exception - https://issues.apache.org/jira/browse/CXF-3128?focusedCommentId=12932648&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12932648 – Betlista Mar 21 '13 at 15:52