0 Replies Latest reply on Jan 16, 2013 4:46 AM by Siva NB

    JAVA HttpPost enctype = “multiform/data”

    Siva NB Newbie

      Hi,

       

      I'm trying to make my own jbpm console client.

       

      i'm facing a blocking issue while create a new instance of a process.

       

      For creating a new instance, the form structure is

       

      <form action="localhost/xyz.aspx" method = "post" enctype="multipart/form-data">
          
      <input type="text" name="name">
          
      <input type="text" name="age">
          
      <input type="text" name="submit">
      </form>

       

      So inorder to create a submit request,

      List<NameValuePair> formparams1 = new ArrayList<NameValuePair>();
      formparams1
      .add(new BasicNameValuePair("name","john"));
      formparams1
      .add(new BasicNameValuePair("age", "10"));
      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams1);
      httppost.setEntity(entity);

        httpClient.execute(httppost);

       

      Even this fails.

       

      So tried another approach,

      MultipartEntity entity = new MultipartEntity();
      entity
      .addPart("name",new StringBody("john",Charset.forName("UTF-8")));
      entity
      .addPart("age", new StringBody("10",Charset.forName("UTF-8")));

      httppost.setEntity(entity);

      httpClient.execute(httppost);

       

       

      It results in HTTP 400/ HTTP 415 error

       

      Note: followed the pattern in https://community.jboss.org/thread/203492?start=15&tstart=0

       

      Can anyone pls help me

       

      TIA