title: Curl works but corresponding HttpConnection POST request fails as 400 error
body: <p>Here is my curl request , which works perfectly fine. </p>
  
  <p>curl -X POST <a href="http://build-master-mobile.xxx.com:8080/job/Reprovision-IPA/build" rel="nofollow">http://build-master-mobile.xxx.com:8080/job/Reprovision-IPA/build</a> --data-urlencode json='{"parameter": [{"name":"IPA_URL","value":"xxx"}, {"name":"IPA_FILENAME","value":"xxx.ipa"}]}'</p>
  
  <p>Now I am trying to do this post from my java code using Httpconnection as shown below, but it gives me 400 bad request.
  Can the experts help me with this please.</p>
  
  <pre><code>    URL url = new URL("http://build-master-mobile.xxx.com:8080/job/Reprovision-IPA/build"); 
      URLConnection urlConnection = url.openConnection();
      HttpURLConnection httpConn = (HttpURLConnection)urlConnection;
      httpConn.setRequestProperty("Accept", "application/json");
      httpConn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
      httpConn.setRequestProperty("Connection", "keep-alive");
      httpConn.setRequestMethod("POST");
  
      String data = "{\"parameter\":[{\"name\":\"IPA_URL\",\"value\":\"xxx\"},{\"name\":\"IPA_FILENAME\",\"value\":\"xxx.ipa\"}]}";
  
      httpConn.setDoOutput(true);
      httpConn.setDoInput(true);
      // send request
  
          OutputStreamWriter wr = new OutputStreamWriter(httpConn.getOutputStream());
          wr.write(data.toString());
          wr.flush();
          wr.close();
  
      BufferedReader rd = new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
      while ((line = rd.readLine()) != null) {
          result.append(line);
      }
      rd.close();
  </code></pre>