首页 > 解决方案 > 导入 Acumatica TaxCategory 时出现 CommunicationException

问题描述

尝试通过. Tax_TaxCategoryTaxCategoryTaxDetail

var categoryDetails = new TaxCategoryTaxDetail
{
    TaxID = new StringValue {Value = "MYTAXID"},
    TaxCategory =  new StringValue {Value = "TAXABLE"},
};

var category = new TaxCategory
{
    TaxCategoryID = new StringValue {Value = "TAXABLE"},
    Details = new[] {categoryDetails}
};

_client.Put(category);

调用Put抛出:

The maximum message size quota for incoming messages (6553600) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

端点版本:17.200.001 Acumatica 版本:18.107.0022 客户端应用程序在 Visual Studio 2017 中使用 wsdl 端点。

categoryDetails与我正在使用的其他一些工作调用相比,有效负载很小。

categoryDetails虽然正确保存在 Acumatica 中。似乎 Put 正在执行更新,然后将实际类别从服务器返回给客户端。Acumatica 中的类别包含数千条相关的税务记录。我不想要或不需要这个。我宁愿它是一场火灾而忘记更新。

我可以catch抛出异常并继续,但是等待异常抛出的速度非常慢。我觉得我在这里做错了什么。

标签: acumatica

解决方案


返回的数据长度超过MaxReceivedMessageSize绑定属性。

您可以增加“app.config”文件中的限制:

<binding name="DefaultSoap" allowCookies="true" maxReceivedMessageSize="2147483647">
    <security mode="Transport" />
</binding>

或直接在soap客户端构造函数中:

using (soapClient = new DefaultSoapClient(new BasicHttpBinding()
{
    AllowCookies = true,
    Name = "DefaultSoap",
    MaxBufferSize = 2147483647,
    MaxReceivedMessageSize = 2147483647,
    Security = new BasicHttpSecurity() { Mode = BasicHttpSecurityMode.Transport }
},
new EndpointAddress(url)))
{
}

在 webservice 调用中,您还可以指定返回行为:

ReturnBehavior = ReturnBehavior.None

推荐阅读