核心代码:
String Save_URL = ulr+"/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.View.common.kdsvc";
URI save_uri = new URI(Save_URL);
HttpPost method = new HttpPost(save_uri);
String jsonParam = "{\"formid\":\"BD_MATERIAL\",\"obj\":{\"CreateOrgId\":1,\"Number\":\"AD.10001\",\"Id\":\"109724\"}}";
StringEntity entity = new StringEntity(jsonParam, "utf-8");
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
//把成功登录的Session信息传进去,获取连接信息
method.setHeader(sessionkey, sessionValue);
method.setHeader(aspnetsessionkey, aspnetsessionValue);
//方法参数
method.setEntity(entity);
HttpResponse result = httpclient.execute(method);
返回:
{"Result":{"ResponseStatus":{"ErrorCode":500,"IsSuccess":false,"Errors":[{"FieldName":"未将对象引用设置到对象的实例。","Message":" 在 Kingdee.BOS.WebApi.FormService.View.Execute()\r\n 在 Kingdee.BOS.WebApi.FormService.BillOperationService.ExecuteOperation(FormOperation op, String data)","DIndex":0}],"SuccessEntitys":[]}}}
推荐阅读