我调用Web API的提交操作时,出现异常,异常让人看不明白,是那个地方错了吗?求大神指点。
以下是调用时使用的代码:
private void button2_Click(object sender, EventArgs e)
{
ApiClient client = new ApiClient("win-0vs5fckt8od/K3Cloud/");
object[] loginInfo = new object[] {
"000c29be5fc2930011e46f3f1d2e719a",//帐套Id
"Daly",//用户名
"888888",//密码
2052};//语言id
var ret = client.Execute
var result = JObject.Parse(ret)["LoginResultType"].Value
if (result == 1)
{
JObject js = new JObject();
js.Add("CreateOrgId", "0");
JArray array = new JArray();
array.Add("ABC");
js.Add("Numbers", array );
ret = client.Execute
js.ToString () });
JObject j = JObject.Parse(ret);
MessageBox.Show(j["Message"].ToString());
}
}以下是返回结果:
{
"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": "列名 'ABC' 无效。",
"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.Submit(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": "列名 'ABC' 无效。",
"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
}
不止提交操作,其他的如审核删除反审核之类的操作,都有同样的问题。
不知道代码的什么位置有错误,求指点。
推荐阅读