I wanna send my data to web service. But i can't send
{ "OrgID":"1",
"UserDepartment":"1",
"WorkType":"1977",
"WorkDefinition":"EXAMPLE_EXAMPLE",
"Confirmed":[
{ "Confirmed":"qaAgo/+/j/XhECIhlAo2SQ==",
"Confirmed":"PJNd6u9RwTIwM4SRrom+mQ==",
"Confirmed":"75qFEZ7bnq+kCFvLS625Ww=="}],
"FileName":"",
"FileMimeType":"",
"FileContent":""
}
i can send all data except "Confirmed".
My Java codes here..
public static void sendParameter(String organizationId, String departmentId, String workType, String comfirmedList, String fileName, String fileMimeType, String fileContent, String definition) {
parameterList = new ArrayList<NameValuePair>();
parameterList.add(new BasicNameValuePair("OrgID", organizationId));
parameterList.add(new BasicNameValuePair("UserDepartment", departmentId));
parameterList.add(new BasicNameValuePair("WorkType", workType));
parameterList.add(new BasicNameValuePair("Confirmed", comfirmedList));
parameterList.add(new BasicNameValuePair("FileName", fileName));
parameterList.add(new BasicNameValuePair("FileMimeType", fileMimeType));
parameterList.add(new BasicNameValuePair("FileContent", fileContent));
parameterList.add(new BasicNameValuePair("WorkDefinition", definition));
}
How can i send Confirmed datas?
You can manually format the data as json string and sent the json string as entity to the request. On the server side make sure you have a Class that matches the exact structure. Example
String paramString = "{\"OrgID\":\"" + OrgID
+"\",\"UserDepartment\":\"" + UserDepartment
+"\",\"WorkType\":\"" + WorkType+ "\"}";
HttpEntity httpEntity = null;
try {
httpEntity = new StringEntity(paramString);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/json");
httpPost.setEntity(entity);
EDIT
So sorry, my json must be
{ "OrgID":"1",
"UserDepartment":"1",
"WorkType":"1977",
"WorkDefinition":"EXAMPLE_EXAMPLE",
"Confirmed":[
{"Confirmed":"qaAgo/+/j/XhECIhlAo2SQ==,}
{"Confirmed":"qaAgo/+/j/XhECIhlAo2SQ=="}],
"FileName":"",
"FileMimeType":"",
"FileContent":""
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.