嗨,我是有问题的2009 R2网络服务!
有一个名为OrderGoodsInsert的webMethod,它需要参数lLanguageId int,lRec Text 250
lRec应该是一个字符串数组,其值如下
使用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
我做错了什么吗?
发布于 2016-11-01 08:02:03
问题是WS的开发人员进行了更改,没有发送新的文档。在表示项目所在的架子的数组中还需要一个字符串。
发布于 2016-10-25 12:12:50
您的OrderGoodsInsert
方法在SOAP定义上如下所示
<sequence>
<element minOccurs="1" maxOccurs="1" name="lLanguageId" type="int"/>
<element minOccurs="1" maxOccurs="unbounded" name="lRec" type="string"/>
</sequence>
因此,它期望变量string
用于变量lRec
,而不是string[]
。
尝试将Array转换为带有分隔符的单个字符串。
navWS.OrderGoodsInsert(1062, string.Join(";", arr));
但我不确定哪一个是NAV WebServices的正确分隔符。
https://stackoverflow.com/questions/40238873
复制相似问题