【发布时间】:2017-03-07 10:31:00
【问题描述】:
您好,我在使用 Microsoft Dynamics NAV 2009 R2 Web 服务时遇到问题!
有一个名为 OrderGoodsInsert 的 webMethod 需要参数 lLanguageId [int], lRec [Text 250] [100]
lRec 应该是一个字符串数组,包含这些值
- “文档类型”
- “证件号”
- “行号” - (创建时为空)
- “插入用户”
- “修改用户”
- “类型”[0 – „”, 1 – 总账科目, 2 – 项目, 3 – 资源, 4 – 固定资产, 5 – 费用(项目)]
- “没有。” – 商品代码
- 数量
使用 c# 代码,我尝试调用作为 Web 服务引用添加到我的项目的方法。代码:
string[] arr = new string[8];
arr[0] = "1";
arr[1] = currentDocNo;
arr[3] = "SU04";
arr[5] = "2";
arr[6] = item.Code;
arr[7] = item.Amount;
arr[2] = "";
arr[4] = "";
navWS.OrderGoodsInsert(1062, arr);
但是当我这样做时,我得到了
A first chance exception of type 'System.Net.WebException'
occurred in System.dll
A first chance exception of type 'System.Web.Services.Protocols.SoapException'
occurred in System.Web.Services.dll
错误是index out of bounds
我是不是做错了什么?
【问题讨论】:
-
OrderGoodsInsert的 SOAP 请求看起来如何?这是服务器端异常还是客户端?请将您的函数的 WSDL 部分添加到问题中。 -
另外,
item.Code包含什么值? -
一个字符串,例如“0067444”
-
dpaste.de/PHBd 希望我明白你想要什么
-
从 NAV 方面看,lRec 是一个 100 维的 Text250 变量,对吧?那么,我相信,arr 变量的大小应该是 100 而不是 8。
标签: c# navision dynamics-nav dynamics-nav-2009