Exceptions and web services

Posted by Schildmeijer on Stack Overflow See other posts from Stack Overflow or by Schildmeijer
Published on 2009-08-13T06:15:03Z Indexed on 2010/03/28 17:13 UTC
Read the original article Hit count: 298

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about web-services