JBoss Community

JAVA HttpPost enctype = “multiform/data”

created by Siva NB in jBPM - View the full discussion

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);

 

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

 

Can anyone pls help me

 

TIA


Reply to this message by going to Community

Start a new discussion in jBPM at Community