5

We use Salesforce integration with WCF service. Currently, we are facing an issue of operation has timed out. We add chatter feed with mention using REST API and other operations doing using SOAP API. After the some requests of REST API, all operations are getting timeout. We create Salesforce connection in every time and dispose it every time in operation. We are unable to identify the issue.

If someone can help me.

2
  • You are calling out from Salesforce or to Salesforce
    – Ashwani
    Mar 12, 2015 at 11:08
  • @Ashwani - We are calling out from Salesforce (.Net application).
    – Girish
    Mar 12, 2015 at 11:11

3 Answers 3

4

You can set REST API call-out time to maximum 120 second. If your .NET application is unable to process request in 120 seconds then you will have to optimize .net webservice. Default timeout is 10 seconds.

Sample:

        HttpRequest req = new HttpRequest();
        req.setEndpoint(endpoint_url);
        req.setMethod('GET');
        req.setTimeout(120000);
4
  • 1
    We process 200 to 250 requests one by one at a time. Around 100 request processes successfully after that we continue getting time-out. So I think setTimeout(120000) will not work.
    – Girish
    Mar 12, 2015 at 12:13
  • 2
    @Girish I will recommed to use (Asynchronous) Apex Batch to process such large number of callouts. You won't be able to do it synchronously.
    – Ashwani
    Mar 12, 2015 at 12:22
  • Any other solution that we can run in .Net application using Rest API.
    – Girish
    Mar 12, 2015 at 12:45
  • 1
    @Girish There is no solution. You will have to use batch class or make changes in .net applications to process more data in single (few) callouts. Salesforce has governor limit as we cannot make more that 100 call-outs and total callout time must not exceed 120 seconds.
    – Ashwani
    Mar 14, 2015 at 13:44
0

@Girish: Are you trying to call a .Net REST API from Salesforce probably 200-250 in same transaction? If so, the first suggestion would be to optimize .NET api to be able to handle bulk requests for e.g. 50-100 requests in same call. It will not only help you achieve it within Salesforce, but also improve performance as there would be less network usage. It's always a best practice to bulkify web service methods.

Alternatively, there would be following approaches (not optimal)

  1. As mentioned by other members, use batch apex to be able to surpass governor limit of 100 API calls in a transaction
  2. If the invocation involves a visualforce page, you can invoke web service via javascript which does not fall within Salesforce limits and you can send as many requests as you want

However, I would still recommend bulkifying your .Net web service to handle more requests/ records in single invocation.

-1

Total number of callouts (HTTP requests or Web services calls) in a transaction is 100,....

So if you have to really issue 100+ request you need to go asch , also if possible bulkify your request rather than sending 250 + request. if that is possible and right for you.

Please paste your code. we can see for any other way..

Best Regards, Hari

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .