title: Throw custom exception for soap webservice in Spring-Boot?
body: <p>I'm creating a <code>soap webservice</code> with <code>spring-boot</code>.</p>
  
  <p>By default I wrap every <code>@WebMethod</code> code in a try-catch, so that when any <code>Exception</code> ocurs I can translate it to my own <code>@WebFault</code>.</p>
  
  <pre><code>@Component
  @WebService
  public class MyService extends SpringBeanAutowiringSupport {
  
      @WebMethod
      public void test() {
          try {
              //connect to another soap service, which throws a java.net.SocketTimeoutException: Read timed out
          } catch (Exception e) {
              throw new MyException("my custom error msg");
          }
      }
  }
  
  @WebFault
  public class MyException extends Exception {
      public MyException(String value) {  
          super(value);
      }
  }
  </code></pre>
  
  <p>Problem: If eg a <code>java.net.SocketTimeoutException</code> ocurs in the webmethod, the spring-boot <code>ErrorPageFilter</code> is called instead of returning my custom <code>@WebFault</code>:</p>
  
  <p>But why? Could I disable it? How can I get my error fault message returned?</p>
  
  <pre><code>[] 2014-09-08 09:20:51,251 ERROR org.springframework.boot.context.web.ErrorPageFilter: Forwarding to error page from request [/services/MyService] due to exception [null]
  org.apache.catalina.connector.ClientAbortException
      at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) ~[catalina.jar:7.0.50]
      at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) ~[catalina.jar:7.0.50]
      at org.apache.catalina.connector.Response.flushBuffer(Response.java:570) ~[catalina.jar:7.0.50]
      at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307) ~[catalina.jar:7.0.50]
      at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:115) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
      at org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:58) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
      at org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:87) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
      at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:100) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.50]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.50]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [catalina.jar:7.0.50]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) [catalina.jar:7.0.50]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:7.0.50]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.50]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) [catalina.jar:7.0.50]
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) [catalina.jar:7.0.50]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.50]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409) [catalina.jar:7.0.50]
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044) [tomcat-coyote.jar:7.0.50]
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) [tomcat-coyote.jar:7.0.50]
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315) [tomcat-coyote.jar:7.0.50]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_51]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_51]
      at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51]
  </code></pre>