java调用物料查看接口报错
金蝶云社区-周水霞
周水霞
0人赞赏了该文章 995次浏览 未经作者许可,禁止转载编辑于2016年06月14日 14:26:45

核心代码:
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":[]}}}