Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-205

Allow customization of the "SoapFault" produced by the SimpleSoapExceptionResolver

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.2
    • Component/s: None
    • Labels:
      None

      Description

      If the SimpleSoapExceptionResolver.resolveExceptionInternal allowed a hook method to customize the SoapFault produced by the body.addServerOrReceiverFault(faultString, locale) method.

      For example...

          protected boolean resolveExceptionInternal(MessageContext messageContext, Object endpoint, Exception ex) {
              Assert.isTrue(messageContext.getResponse() instanceof SoapMessage,
                      "SimpleSoapExceptionResolver requires a SoapMessage");
              SoapMessage response = (SoapMessage) messageContext.getResponse();
              String faultString = StringUtils.hasLength(ex.getMessage()) ? ex.getMessage() : ex.toString();
              SoapBody body = response.getSoapBody();
              SoapFault fault = body.addServerOrReceiverFault(faultString, locale);
              customizeFault(messageContext, endpoint, ex, fault);
              return true;
          }
       
          /**
           * Hook method to allow subclasses an opportunity to customize the {@link SoapFault}
           *
           * @param messageContext current message context
           * @param endpoint       the executed endpoint, or <code>null</code> if none chosen at the time of the exception
           * @param ex             the exception that got thrown during endpoint execution
           * @return <code>true</code> if resolved; <code>false</code> otherwise
           * @see #resolveExceptionInternal(org.springframework.ws.context.MessageContext, Object, Exception) 
           */
          protected void customizeFault(MessageContext messageContext, Object endpoint, Exception ex, SoapFault fault) {
          }

        Activity

        Hide
        raykrueger Ray Krueger added a comment -

        Updating this as my original patch didn't include the MessageContext, Endpoint, or Exception in the "customizeFault" method signature

        Show
        raykrueger Ray Krueger added a comment - Updating this as my original patch didn't include the MessageContext, Endpoint, or Exception in the "customizeFault" method signature
        Hide
        raykrueger Ray Krueger added a comment -

        This patch supersedes my previous patch file, sorry.

        Show
        raykrueger Ray Krueger added a comment - This patch supersedes my previous patch file, sorry.
        Show
        raykrueger Ray Krueger added a comment - The proper patch file is http://opensource.atlassian.com/projects/spring/secure/attachment/12994/SimpleSoapExceptionResolver.java.patch
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Fixed. Thanks!

        Show
        arjen.poutsma Arjen Poutsma added a comment - Fixed. Thanks!
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.2 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.2 issues.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            raykrueger Ray Krueger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: