Our external API works perfectly fine when tested on browser. However when called from inside Salesforce controller, it times out.

What could be wrong?


There are lot of factors that can cause time outs..

simplest factor is network latency.. if your web service is hosted in your local region, and when you invoke the service from your browser the round trip of request / response is between ur system and web service server which will be shorter

Since the Apex controllers run on salesforce servers, if your salesforce instance is in a different region the round trip of request / response between salesforce and your web service servers will be longer and if its not falling under the default timeout of 10 seconds, it will time out.

you can always configure (increase) the timeout when you make the web service callout from your apex class.

| improve this answer | |
  • I increased the timeout on server and Salesforce and set 'Content-Length' header value to '0' It worked :) – pooran Sep 9 '15 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.