title: How to deal with SocketTimeoutException inside Java Code / Webservices
body: <p>This is my Method code shown below </p>
  
  <p>Actually this serves as a Webservices Method .</p>
  
  <pre><code>public Response getData(ServiceRequest request)
  {
      try
      {
          final   boolean toProceedorNot = validate(legdata);
          if (!toProceedorNot) {
              status.setErrorText(errorText);
              return response;
          } 
          else {
              // Some Processing is done here
              response.setMessage(result);
          }                           
      }
  
      catch(Exception e)
      {
          errorText = e.getMessage().toString();
          status.setErrorText(errorText);
          response.setStatus(status);
      }
  
      return response;
  }
  </code></pre>
  
  <p>If the execution of the Method takes longer time , an SocketTimeoutException will be thrown by the Apache CXF Framework</p>
  
  <pre><code>at java.lang.Thread.run(Thread.java:662)
      Caused by: java.net.SocketTimeoutException: Read timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:129)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
      at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:695)
      at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
      at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
      at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2034)
      at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2013)
      at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1938)
      at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
      at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:626)
      at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
  </code></pre>
  
  <p>My Question is that, even though an SocketTimeoutException  is thrown, it is not coming inside the Exception block.</p>
  
  <p>I am not sure whether this Exception , should be handled by whom ( The client or inside the Webservices Implementation method )</p>
  
  <p>But as a Webservice provider , please tell me how to deal with this Exception ??</p>