View Javadoc

1   package org.springframework.ws.client.support.interceptor;
2   
3   import org.xml.sax.SAXParseException;
4   
5   import org.springframework.ws.client.WebServiceClientException;
6   
7   /**
8    * Exception thrown whenever a validation error occurs on the client-side.
9    *
10   * @author Stefan Schmidt
11   * @author Arjen Poutsma
12   * @since 1.5.4
13   */
14  public class WebServiceValidationException extends WebServiceClientException {
15  
16      private SAXParseException[] validationErrors;
17  
18      /**
19       * Create a new instance of the <code>WebServiceValidationException</code> class.
20       *
21       * @param msg the detail message
22       */
23      public WebServiceValidationException(SAXParseException[] validationErrors) {
24          super(createMessage(validationErrors));
25          this.validationErrors = validationErrors;
26      }
27  
28      private static String createMessage(SAXParseException[] validationErrors) {
29          StringBuffer buffer = new StringBuffer("XML validation error on response: ");
30  
31          for (int i = 0; i < validationErrors.length; i++) {
32              buffer.append(validationErrors[i].getMessage());
33          }
34          return buffer.toString();
35      }
36  
37      /** Returns the validation errors. */
38      public SAXParseException[] getValidationErrors() {
39          return validationErrors;
40      }
41  }