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.