Web Services Configuration Settings for Integrating Large Transactions
It is definitely possible to use Web Services for Microsoft Dynamics GP to create large transactions. By large transactions I am referring to examples of where a sales invoice would have several thousands of lines on it. That's right, some companies are integrating transactions this large using our Web Services for Dynamics GP!
I had a recent support case where a business requirement was to create a sales invoice with 20,000 lines on it. The eConnect XML string that Web Services ultimately creates will be very large and several minutes can go by in this case. Depending on hardware and the environment it could take an hour for a transaction of that size to complete. This XML string is passed to the eConnect .Net API where the Microsoft Distributed Transaction Coordinator (MSDTC) is used to communicate with the SQL server and make sure it runs in one transaction. This is where the MSDTC timeout settings and other timeout values in the configuration files come into play. If the settings are not used the transaction will timeout from MSDTC and any eConnect stored procedures that have updated the database will rollback.
It's important to know that transactions of this size are not necessarily recommended when compared to the other option of sending in many smaller transactions with less lines associated to them. A smaller XML document will process faster. SQL locks associated to tables like the SY01500 and IV00102 tables will be let go quicker on smaller transactions. So sending in large transactions takes some consideration as to when to do it.
You may see one or more of the below errors in the Web Services Exception Console, eConnect Event Log, or the custom application using the Web Services when a timeout situation happens:
Microsoft Distributed Transaction Coordinator (MSDTC) has cancelled the transaction.
The operation has timed out.
Thread was aborted.
The operation is not valid for the state of the transaction.
To avoid these timeout errors, use the following strategy by making the changes below:
1. On the Web Services computer, set the MSDTC global transaction timeout value to 0. Make sure the eConnect COM+ application components Microsoft.Dynamics.GP.eConnect.eConnectInternalMiscMethods and Microsoft.Dynamics.GP.eConnect.eConnectMethods do not override it.
a. Go to Administrative Tools-Components Services-Expand My Computers and right click on My Computer and choose Properties. Set the Transaction Timeout field to 0.
b. Expand My Computer - COM+ Applications - eConnect 10 for Microsoft Dynamics GP - Components and right click on the Microsoft.Dynamics.GP.eConnect.eConnectInternalMiscMethods and choose Properties. Make sure the Override global transaction timeout value is not marked under the Transactions tab. Do the same for the Microsoft Dynamics.GP.eConnect.eConnectMethods component.
2. Add the following httpRuntime values between the </customErrors> and <webServices> sections in the web.config file. The default location for the web.config file is C:\Program Files\Microsoft Dynamics\GPWebServices\WebServices.
<httpRuntime maxRequestLength="81920" executionTimeout="300000"/>
3. Increase the TransactionTimeoutSeconds value from 60 to a larger number in the web.config file from step 2.
<add key="TransactionTimeoutSeconds" value="9999" />
4. Add the following <system.transactions> section to the machine.config file for the .Net Framework 2.0. The default location for the machine.config file is C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config. You can place the section directly under </system.data> .
5. In the application code that calls the Web Services for Dynamics GP, set the Timeout property on the DynamicsGP object:
// Create an instance of the web service
DynamicsGP wsDynamicsGP = new DynamicsGP();
wsDynamicsGP.Timeout = System.Threading.Timeout.Infinite;
Hopefully these settings will help in your Dynamics GP Web Service or eConnect applications where the transaction is running into a timeout error.
// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)