Description
If the exceptions generated from wsdl/xsd are used with the constructor without parameters, then they just contain as a exception message the name of the class and ignore the complete content of the exception, even if there is much more information available. This is especially problem in Stubs, where wsdl2java generates the received exception instantiation with exceptionClass.newInstance(); what leads to the fact in stub is effectively no exception message available. So, for example in the Unit-tests results normally the stacktrace of some exceltion ExceptionClassName with exception message is shown without any detail, You have always to go into the debugger and figure out what is the real fault behind the exception messsage "ExceptionClassName" is. This is very time consuming. Sure, one can take the exception generated by Axis and extend it, but then if the wsdl changes, it has to be regenerated, resynchronized, etc. etc.
So, my proposal is to override in the generated exception the method getMessage() by something similar to:
/**
- @see java.lang.Throwable#getMessage()
*/
@Override
public String getMessage()Unknown macro: { String locMessage = super.getMessage(); if (getFaultMessage() != null && getFaultMessage().getXXXXFaultMessageContent() != null && (locMessage == null || this.getClass().this.getClass().getName().endsWith("." + locMessage))) { locMessage = getFaultMessage().getXXXXFaultMessageContent().getFaultMessage() } return locMessage; }
where getXXXXFaultMessageContent is the name of the access method to fault content, generated according to the name convention already used in the wsdl2java tool.
With similar construct there would be no necessity to change the generated code and would be very helpful for the default usage of the Axis2 tools.