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) {
          }
      

        Attachments

          Activity

            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: