Java rest service client send file and data

I have a rest service that can I post file and data, this works fine like this (Restlet Client in Chrome complement):

enter image description here

but I’v been working this in java code:

public static void consultaPost2f() {

try {
        File file = new File("/home/teno/Documentos/test.pdf");
        String url="https://tramites.subtel.gob.cl/ServiciosCON/rest/CargaArchivos";

    CloseableHttpClient client = HttpClients.createDefault();
    HttpPost httpPost = new HttpPost(url);
    httpPost.addHeader("Content-Type","application/x-www-form-urlencoded;");

    MultipartEntityBuilder builder = MultipartEntityBuilder.create();
    builder.addTextBody("codEmpresa", "204");
    builder.addTextBody("nroIngreso", "123");
    builder.addTextBody("codDocumento", "105");
    builder.addTextBody("fechaVencimiento", "2018-02-28");
    //builder.addTextBody("archivoCargado", "test.pdf");
    //builder.addBinaryBody("archivoCargado", file,ContentType.create("application/pdf"), "test.pdf");
    builder.addBinaryBody("archivoCargado", file,ContentType.MULTIPART_FORM_DATA, "test.pdf");
    HttpEntity multipart = builder.build();
    httpPost.setEntity(multipart);

    CloseableHttpResponse response = client.execute(httpPost);

    if (response != null) {
        HttpEntity responseEntity = response.getEntity();
        if (responseEntity != null) {
            // Read the response string if required
            InputStream responseStream = responseEntity.getContent() ;
            if (responseStream != null){
                BufferedReader br = new BufferedReader (new InputStreamReader (responseStream)) ;
                String responseLine = br.readLine() ;
                String tempResponseString = "" ;
                while (responseLine != null){
                    tempResponseString = tempResponseString + responseLine + System.getProperty("line.separator") ;
                    responseLine = br.readLine() ;
                }
                br.close() ;
                if (tempResponseString.length() > 0){
                    System.out.println(tempResponseString);

                }
            }
            responseStream.close();
        }
    }

    client.close();



  } catch (MalformedURLException e) {

    e.printStackTrace();

  } catch (IOException e) {

    e.printStackTrace();

  }

}

but the giveme this error:

Apache Tomcat/8.0.32 (Ubuntu) – Informe de ErrorH1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}

Estado HTTP 400 – Bad Request

type Informe de estado

mensaje Bad Request

descripción El requerimiento enviado por el cliente era sintácticamente incorrecto.

Apache Tomcat/8.0.32 (Ubuntu)