how to set the timeout while exporting data using webservices api in acumatica

自古美人都是妖i 提交于 2020-01-04 02:13:08

问题


This is the first scenario: - I create new "bill" document in acumatica system using webservices api to Bill and Adjustments screen (AP301000). - after that, I need to load all document records in Application tab menu of the current screen (AP301000) using webservices also for set off process. the problem is there are a lot of documents that will be loaded. It's about 9500 documents and of course need more times to proceed (it's about 10 minutes).

I always get an error in exporting process all records in this Aplication Tab menu. and the error message is "Operation Timeout".

Is there any reference to set the timeout in exporting process of a huge documents through the webservices api.

sCon.getLoginSettlementVoucher(context);
AP301000Content billSchema2 = context.AP301000GetSchema();
List<Command> cmds = new List<Command>();
billSchema2.DocumentSummary.Type.Commit = false;
billSchema2.DocumentSummary.Type.LinkedCommand = null;

var command2 = new Command[]
{
        new Value { Value = "Bill", LinkedCommand = billSchema2.DocumentSummary.Type},
        new Value { Value = "17000034", LinkedCommand = billSchema2.DocumentSummary.ReferenceNbr},
        billSchema2.Applications.DocTypeDisplayDocType,
        billSchema2.Applications.ReferenceNbrDisplayRefNbr,
        billSchema2.Applications.Balance,
        billSchema2.Applications.AmountPaid
 };
 try
 {
        var applications = context.AP301000Export(command2, null, 0, false, true); 
        ..........................
  }
  catch(Exception x){} finally{context.Logout()}

回答1:


Here is the link to WebClientProtocol.Timeout property on MSDN - it's way better to check MSDN since the Timeout property is derived from one of base classes in the .Net framework

The way to do it would be to change the Timeout value of the Screen object. In your case, I think that object is "context".

The default value is 100000 and this is in milliseconds, so 1 minute 40 seconds. If you were to change this value to 700000 which is around 11 minutes and a half, you should be fine.

Here is how to do it :

context.Timeout = 700000;



来源:https://stackoverflow.com/questions/43273901/how-to-set-the-timeout-while-exporting-data-using-webservices-api-in-acumatica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!