title: apache httpclient pfx file
body: <p>I'm using apache httpclient 4.5.3 and apache httpcore 4.4.6. I need to invoke a SOAP WS by doing a POST call</p>
  
  <p>They gave to me a pfx certificate. I used it in SOAP UI by configuring SOAP UI and all works pretty good. I can invoke the WS and it gives to me a response. So the certificate is valid</p>
  
  <p>Now I'm trying to configure apache httpclient in doing the same thing. Here the code I wrote:</p>
  
  <pre><code>KeyStore clientStore  = KeyStore.getInstance("PKCS12"); 
  InputStream instream = Thread.currentThread().getContextClassLoader().getResourceAsStream(keystoreName);
  try {
      clientStore.load(instream, keyStorePwd.toCharArray());
  } finally {
      instream.close();
  }
  SSLContext sslCtx = SSLContext.getDefault();
  SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslCtx);
  Registry&lt;ConnectionSocketFactory&gt; registry = RegistryBuilder.&lt;ConnectionSocketFactory&gt;create().register("https", sslConnectionFactory).register("http", new PlainConnectionSocketFactory()).build();
  PoolingHttpClientConnectionManager pcm = new PoolingHttpClientConnectionManager(registry);
  HttpClientBuilder hcb = HttpClientBuilder.create();
  hcb.setConnectionManager(pcm);
  CloseableHttpClient httpClient = hcb.build();
  </code></pre>
  
  <p>By trying this code I'm not able in invoking successfully the WS. I'm sure I'm missing something but I can't find what I'm missing</p>
  
  <p>May anyone suggest to me how to proceed?</p>
  
  <p>Thank you
  Angelo</p>