title: how to Set connection timeout while invoking soap client
body: <p>Am new to webservice. I had written a soap client and it was working fine. But when the server hosting the web services is not responding we are getting a Failed to access wsdl at the location "" Got Connection timed out: connect while opening stream issue after 25 seconds. During this 25 sec browser hangs up. So i want to restrict connection timeout to 5 seconds. How can i set this to 5 seconds? Below is my code</p>
  
  <pre><code>URL url=null;
  try {
  url = new URL(serviceUrl);
  } catch (MalformedURLException e) {
  e.printStackTrace();
  return "ERROR";
  }
  
  Service service = new Service(url);//Exception is thrown here
  ServiceSoap soap = service.getServiceSoap();
  </code></pre>
  
  <p>Thanks in advance.</p>