ArrayList<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
nameValuePairList.add(new BasicNameValuePair("key",""));
nameValuePairList.add(new BasicNameValuePair("txtenroll","095020693015"));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairList));
MultipartEntityBuilder multipartEntityBuilder =
MultipartEntityBuilder.create();
multipartEntityBuilder.addTextBody("foo", "foo body");
multipartEntityBuilder.addTextBody("foo", "foo body");
ContentType contentType = ContentType.create("application/octet-stream");
String filename = "src/test/resources/org/xmlcml/ckan/test.xml";
File file = new File(filename);
FileBody fooFileBody = new FileBody(file, contentType);
// this doesn't compile even though the signatureis offered by Eclipse
// multipartEntityBuilder.addBinaryBody("foofile", fooFileBody, contentType, filename);
multipartEntityBuilder.addBinaryBody(filename, new FileInputStream(file), contentType, filename);
HttpEntity entity = multipartEntityBuilder.build();
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity result = response.getEntity();