Java EE 7 Application Developer — Question 40
Which statement is true about Java methods that are exposed as Web Service operations by using JAX-WS API?
Answer options
- A. The @WebResult annotation must exist.
- B. Method parameters and return types must be JAXB compatible.
- C. Method parameters must be declared by using @WebParam.
- D. The @WebMethod annotation must exist.
Correct answer: D
Explanation
The correct answer is D because the @WebMethod annotation is essential for exposing a Java method as a web service operation in JAX-WS. Options A, B, and C are not mandatory for a method to be exposed; while they can be used for additional functionality or compatibility, they are not required for the method to be recognized as a web service operation.