mxmissile
mxmissile

Reputation: 11673

CommunicationException when importing Acumatica TaxCategory

Trying to import/set a Tax to TaxCategory connection via a TaxCategoryTaxDetail.

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);

Calling Put throws:

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.

Endpoint version: 17.200.001 Acumatica version: 18.107.0022 Client app is in Visual Studio 2017 using the wsdl endpoint.

The categoryDetails payload is tiny compared to some other working calls I am using.

categoryDetails are saved in Acumatica correctly though. It seems as if Put is doing the update, then returning the actual category from the server back to the client. The category in Acumatica contains thousands of related Tax records. I do not want or need this. I'd rather it be a fire and forget update.

I could catch the exception and continue on but it is extremely slow waiting for exception to throw. And I feel I am just doing something wrong here.

Upvotes: 0

Views: 57

Answers (1)

Hugues Beauséjour
Hugues Beauséjour

Reputation: 8278

The returned data length exceed MaxReceivedMessageSize binding property.

You can increase the limit in 'app.config' file:

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

or directly in the soap client constructor:

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

In the webservice call you can also specify the return behavior:

ReturnBehavior = ReturnBehavior.None

Upvotes: 1

Related Questions