调用webAPI保存供应商资料报错
金蝶云社区-云社区用户z3xD9270
云社区用户z3xD9270
0人赞赏了该文章 1,676次浏览 未经作者许可,禁止转载编辑于2015年11月17日 14:05:50

[code]我调用如下代码去生成供应商资料:[/code][code] JObject js = new JObject();
js.Add("Creator", "");
js.Add("NeedUpDateFields", new JArray());

JObject model = new JObject();
js.Add("Model", model);

model.Add("FNumber", "A");
model.Add("FName", "A");
model.Add("FSupplyClassify", "CG");

model.Add("FCreateOrgId", K3CloudClient.JsonObject("FNumber", "100"));
model.Add("FUseOrgId", K3CloudClient.JsonObject("FNumber", "100"));

JObject tmp = new JObject();
model.Add("BD_Supplier__FBaseInfo", tmp);

tmp = new JObject();
tmp.Add("FPayCurrencyId", K3CloudClient.JsonObject("FNumber", "PRE001"));
tmp.Add("FTaxType", K3CloudClient.JsonObject("FNumber", "SFL02_SYS"));
tmp.Add("FInvoiceType", "2");
tmp.Add("FTaxRateId", K3CloudClient.JsonObject("FNumber", "SL01_SYS"));
model.Add("BD_Supplier__FFinanceInfo", tmp);

tmp = new JObject();
tmp.Add("FVmiBusiness", false);
model.Add("BD_Supplier__FBusinessInfo", tmp);

JArray ja = new JArray();
model.Add("BD_Supplier__FBankInfo", ja);
ja = new JArray();
model.Add("BD_Supplier__FLocationInfo", ja);

ja = new JArray();
model.Add("BD_Supplier__FSupplierContact", ja);
JObject ret = K3CloudClient.Invoke("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
new object[] { "BD_Supplier", js.ToString() });[/code]

[indent]结果报了如下错误:[/indent][indent]{"InnerExWrapper":{"IsEmpty":false,"Data":{},"HelpLink":null,"Message":"调用的目标发生了异常。","Source":null,"StackTrace":" 在 System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)\r\n 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)\r\n 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceExecutor.Execute(KDServiceContext context, ServiceType svcType, String[] paraValues, SerializerProxy serializeProxy, ServiceType beginMethod)","TargetSite":null,"ExceptionType":"System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","InnerException":{"IsEmpty":false,"Data":{},"HelpLink":null,"Message":"给定关键字不在字典中。","Source":null,"StackTrace":" 在 Kingdee.BOS.WebApi.FormService.WebApiServiceCall.ExecuteOperation(Context ctx, FormMetadata metadata, FormOperation op, String data)\r\n 在 Kingdee.BOS.WebApi.FormService.WebApiServiceCall.ExcuteSpecialOperation(Context ctx, String formId, String data, Int64 opId)\r\n 在 Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save(String formid, String data)","TargetSite":null,"ExceptionType":"System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","InnerException":null}},"ClassName":"Kingdee.BOS.ServiceFacade.ServiceException","Message":"给定关键字不在字典中。","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" 在 Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceExecutor.Execute(KDServiceContext context, ServiceType svcType, String[] paraValues, SerializerProxy serializeProxy, ServiceType beginMethod)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.ExecuteServiceModule.OnProcess(KDServiceContext context)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.ModulePipeline.ExcuteRequest(KDServiceContext context)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.RequestExcuteRuntime.BeginRquest(RequestExtractor requestExtractor, WebContext webCtx)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.RequestExcuteRuntime.StartRequest(RequestExtractor requestExtractor, WebContext context)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.KDSVCHandler.ExecuteRequest(WebContext ctx, RequestExtractor requestExtractor)\r\n 在 Kingdee.BOS.ServiceFacade.KDServiceFx.KDSVCHandler.ProcessRequestInternal(WebContext webCtx, RequestExtractor requestExtractor)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nExecute\nKingdee.BOS.ServiceFacade.KDServiceFx, Version=5.1.206.6, Culture=neutral, PublicKeyToken=null\nKingdee.BOS.ServiceFacade.KDServiceFx.ServiceExecutor\nSystem.String Execute(Kingdee.BOS.ServiceFacade.KDServiceFx.KDServiceContext, Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceType, System.String[], Kingdee.BOS.ServiceFacade.SerializerProxy, Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceType)","HResult":-2147467259,"Source":"Kingdee.BOS.ServiceFacade.KDServiceFx","WatsonBuckets":null,"_httpCode":500}[/indent][indent]我只为必录字段赋了值,是什么关键字不在字典中呢?[/indent][indent]我的代码什么地方有错误?急求指点。[/indent]