title: How do I use SSLContext with axis
body: <p>I have a web app that calls a webservice that requires an SSL certificate. We have a class that implements X509KeyManager for getting the certificate, and I can build an instance of SSLContext with that key manager, but I'm having no luck using it.</p>
  
  <p>I used wsdl2java to generate the classes for the requests using axis (1), unfortunately all the solutions I've found are for axis2.</p>
  
  <p>Here are a couple solutions I've found for axis2 that I haven't been able to replicate with axis (1):</p>
  
  <pre><code>//solution 1
  BindingProvider bindingProvider = (BindingProvider) service; 
  bindingProvider.getRequestContext().put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory", sslContext.getSocketFactory());
  
  //solution 2
  aStub._getServiceClient().getOptions().setProperty(HTTPConstants.CUSTOM_PROTOCOL‌​_HANDLER, new Protocol("https",(ProtocolSocketFactory)new SSLProtocolSocketFactory(sslCtx),443));
  </code></pre>