title: Connect to SSL certificate secured WebService from WebSphere
body: <p>we have WAS (Websphere Application Server) 7 web service, that is somekind of proxy to other party SSL secured WebService. </p>
  
  <p>When using our WebService (Client) outside WAS (for example using eclipse) it will connect with no problem, but not inside WAS. I have also created test service that is using function to print other party WebService (Server) wsdl.</p>
  
  <pre><code>public void testSSL() {
    URL u;
    InputStream is = null;
    DataInputStream dis;
    String s;
  
    try {
  
      System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
      System.setProperty("javax.net.ssl.keyStore", "/home/...");  //path to jks certificate
  System.setProperty("javax.net.ssl.keyStorePassword", "******");
  System.setProperty("javax.net.ssl.requireClientAuth", "true");
  
  u = new URL("https://...?WSDL");
  is = u.openStream();         // throws an IOException
  dis = new DataInputStream(new BufferedInputStream(is));
  
  while ((s = dis.readLine()) != null) {
      System.out.println(s);
  }
    } catch (MalformedURLException mue) {
   System.out.println("Ouch - a MalformedURLException happened.");
   mue.printStackTrace();
   System.exit(1);
    } catch (IOException ioe) {
   System.out.println("Oops- an IOException happened.");
   ioe.printStackTrace();
   System.exit(1);
    } finally {
   try {
      is.close();
   } catch (IOException ioe) {
      // just going to ignore this one
   }
    } // end of 'finally' clause
  } 
  </code></pre>