Exceptions and web services
- by Schildmeijer
Im using the standard java ws implementation shipped with e.g. java6 (javax.jws.*).
I have the following:
import javax.jws.*;
@WebService(name="Widget")
public interface Widget {
@WebMethod
public @WebResult String getGadget(@WebParam(name = "id") long id) throw MyOwnException;
}
Is this possible? Do I have to annotate MyOwnException with e.g the @WebFault annotation?
During my initial tests I also noticed that, on the client side, the autogenerated MyOwnException was renamed to MyOwnException_Exception and wrapped the "original" MyOwnException.
Or if this is a bad idea, are there any recommended Exceptions to throw from a webservice like this?