Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5050

wsdl2java generated exceptions do not display the received fault messages if created with constructor without parameters (f.e. if received and thrown in Stub)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.4.1, 1.5.4
    • None
    • wsdl
    • all

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            goodwin Artur Linhart
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified