title: Enable TLS in HTTP client with Post request
body: <p>I want to add TLS 1.2 to the below code, Tried by creating socket but no luck. Can someone help on it ? Can we add it after creating a client ?</p>
  
  <pre><code>  private static int executeSOAPRequest(String req, String targetURL)
          throws Exception {
      PostMethod post = new PostMethod(targetURL);
      post.setRequestBody(req);
      post.setRequestHeader("Content-type",
              "text/xml; characterset=ISO-8859-1");
      post.setRequestHeader("SOAPAction", "\"\"");
  
      // prepare HTTP Client
      HttpClient client = new HttpClient();
      client.getParams().setParameter("SOAPAction", "\"\"");
  
      // Post the request
      int respCode = client.executeMethod(post);
      System.out.println(post.getResponseBodyAsString());
      // If response is not success
      if (respCode != 200)
          throw new Exception("Executing SOAP request has failed.");
      // Convert the response into NOM XML
      int resp = 0;
      Document doc = nomDocPool.lendDocument();
      try {
          resp = doc.parseString(post.getResponseBodyAsString());
          nomDocPool.returnDocument(doc);
      } catch (XMLException e) {
          nomDocPool.returnDocument(doc);
          //logger.error("Exception while generating SAML : "
                  //+ e);
          throw e;
      }
  System.out.println("resp: "+resp);
      return resp;
  }
  </code></pre>