Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4940

CXF not (always) responding with the correct exception when working with an exception hierarchy

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      Hi there,

      For a webservice I'm currently building (java first), I have a few custom exceptions arranged in a hierarchy. In order to have them properly declared in the WSDL, I list all possible exceptions in the WebMethod declarations, not only the top ones. That is, if exceptions B->A, I declare :
      @WebMethod
      String helloWorld() throws A,B;

      And it works, as far as the WSDL is concerned.
      What doesn't work is that when requesting the service and raising a 'B' (child) exception, the response embeds an 'A' (parent) fault.

      I seem to have narrowed down the culprit to org.apache.cxf.interceptor.FaultOutInterceptor.getFaultForClass(BindingOperationInfo,Class<?>), which stops at the first exception 'assignable to' the one actually raised. I 'patched' it locally to return the 'closest to the one raised', and it does the trick for me.

      I hope an actual CXF contributor can take a look at this issue. I'm a beginner with CXF, and I might use it improperly. Please bear with me if that's the case

      Attachments

        1. FaultOutInterceptor.patch
          1.0 kB
          David G

        Activity

          People

            ffang Freeman Yue Fang
            d.enorme David G
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: