axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lior Weintraub" <Lior.Weintr...@orcainteractive.com>
Subject Help! how to catch application exception - in the client?
Date Mon, 21 Jul 2003 09:33:28 GMT
Hi,

I have the following method I published as web service:
  public String createMediaFile(String name) throws OperationFailedException

Where OperationFailedException extends java.lang.Exception.

I created the wsdl using axis java2wsdl tool.
And created a java client using axis wsdl2java tool.

Now in the client I have the following code:
        try{
            TestExceptionServiceLocator serviceLocator = new TestExceptionServiceLocator();
            TestException stub = serviceLocator.getMypackage6TestException();    
            System.out.println(stub.createMediaFile("3"));
        } catch(mypackage6.OperationFailedException oex) {
            oex.printStackTrace();
        } catch(Exception ex) {
            ex.printStackTrace();
        }

The web service throws a OperationFailedException but in the client it catches the Exception
and not OperationFailedException.

Here is the code for the OperationFailedException class:
package mypackage6;
public class OperationFailedException extends Exception
{
  String msg;
  public OperationFailedException()  {
    super();
  }

  public OperationFailedException(String msg) {
    super(msg);
    this.msg=msg;
  }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String newMsg) {
        msg = newMsg;
    }

}

Please tell me if I did something wrong or that user defined exceptions are simply not handled
by axis? Is there a way that the java client can get the actual java exception that was thrown?

Thanks,
Lior W.

Mime
View raw message