【发布时间】:2017-02-15 17:52:56
【问题描述】:
我正在尝试使用基于合同的 API 根据 Acumatica 中的客户订单字段检索单个销售订单。请参阅下面的代码,该代码基于 Contract Based Documentation(第 82 页)中的代码。
public SalesOrder GetSalesOrder(string orderNumber)
{
var binding = new System.ServiceModel.BasicHttpBinding()
{
AllowCookies = true,
MaxReceivedMessageSize = 655360,
MaxBufferSize = 655360,
SendTimeout = new TimeSpan(0, 2, 0)
};
var soToBeFound = new SalesOrder()
{
OrderType = new StringValue { Value = "SO" },
CustomerOrder = new StringValue { Value = orderNumber }
};
var address = new System.ServiceModel.EndpointAddress(ConfigurationManager.AppSettings["AcumaticaUrl"]);
using (DefaultSoapClient client = new DefaultSoapClient(binding, address))
{
client.Login(_acumaticaUid, _acumaticaPwd, _acumaticaCompany, null, null);
var existingOrder = (SalesOrder)client.Get(soToBeFound);
client.Logout();
return existingOrder;
}
}
当我执行这段代码时,我得到了这个异常:
请求通道在等待回复后超时 00:01:59.9880722。增加传递给调用的超时值 请求或增加 Binding 上的 SendTimeout 值。时间 分配给该操作的可能是较长时间的一部分 超时。”
如您所见,我已经将超时时间增加到 2 分钟,这似乎是永远的。 Acumatica API 真的就这么慢吗?还是我在代码中做错了什么?
编辑:
当我尝试使用“OrderNbr”字段而不是“CustomerOrder”字段时,它运行良好。是否不允许以这种方式通过“CustomerOrder”获取?如果没有,如何在获取请求中使用“CustomerOrder”?
【问题讨论】:
标签: acumatica