Skip to main content

Using existing Exception class for @WebFault

No replies
anders_rundgren
Offline
Joined: 2010-12-29
Points: 0

I am creating server and client code from WSDL.
On the server side it seems that I can throw existing (non-ws-adapted) exceptions if the WSDL declarations match.
On the client side however, I cannot reuse existing exceptions since these neither have @WebFault annotations nor "setters".
Would it be complely insane if the following extension was added to WS:

@WebFault(name = "MyException", targetNamespace = "http://example.com")
public class Wrapper_Exception extends MyException
{

    public Wrapper_Exception(String message, MyExceptionBean faultInfo) {
        super(faultInfo.getArg0 (), faultInfo.getArg1 (), etc etc);
        this.faultInfo = faultInfo;
     }

and instead of (somewhere deep inside of the WS-stack...) throw nicely initiated MyException instead of Wrapper_Exception.
I.e. if the Wrapper_Exception is not derived from Exception, the WS run-time would throw super.wrapper.
Currently the construct above doesn't run at all.
Anders