function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Niki_16Niki_16 

System.CalloutException: IO Exception: Read timed out

I have created a trigger which is calling an external web service to synchronize the leads creation/deletion process. When i delete/create leads the web service is working fine but when i mass upload it(mass import process..) or mass delete process (when it reaches its max limit..i.e. 250) it throws an exception and an error mail is generated with this error "System.CalloutException: IO Exception: Read timed out" error. I have also added the timeout_x property in my code to the max value(60000). But still its throwing the same error. Kindly help. Thanks in advance. Shaveta
aalbertaalbert
Can you debug the external web service to see how long it is taking the bulk operation? Is it taking longer than 60 seconds?
Niki_16Niki_16
yes its taking more than 60 secs as my webservice is inserting/updating records one by one in my local database.
aalbertaalbert
Well, that is why your apex callout is timing out. It has a max of 60 seconds. Can you enhance the web service performance on your side? Otherwise, make it asynchronous so the apex callout doesn't have to wait?
Niki_16Niki_16
The callout is asynchronous (as i have used @future(callout=true) in my apex class). So why it is waiting for the response from the web service?? Also, i am trying to enhance the web service at my end. But is it possible to increase the timout from apex? Also i have found the max timeout for combined apex calls is 120 sec.. how to use this max value..? Thanks Shaveta
aalbertaalbert

I was referring to your side of the webservice being asynchronous - so the apex callout doesn't have to wait more than 60 seconds for the processing to complete. By using the @future, it just creates an asynchronous apex transaction seperate from the transaction that invoked the @future method to begin with (ie trigger). Additionally, the http request within that apex transaction is synchronous. In other words, its waiting for a response from your side. And if your side takes more than 60 seconds, you will receive the exception. A single apex callout (http request) can not exceed 60 seconds. The 120 second combined limit is if your apex transaction has multiple callouts, the total response time can not exceed 120 seconds for all callouts.

 

 

Niki_16Niki_16
Thanks aalbert! The issue has been resolved!
SwetaSweta

Hi,

I am also gettign the same error.

So, please some one tell me how it got resolved?

mittalamittala

I am also having the same issue . Could you please post your solution ?

apurswaniapurswani

I am also facing the same problem. While calling webservice from apex it is showing the error.

 

Here is the .Net Web Service code which returns just "Hello World" String:-

 

    public class Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }

 

 

Now I tried to call this using APEX as follows: -

 

global class HelloWorld
{

    webService static String sampleCSharpWebServiceCall()
    {
        String retVal;
        TestWebServiceForAPEX.Service1Soap csService = new TestWebServiceForAPEX.Service1Soap();
        csService.timeout_x = 90000;
        retVal = csService.HelloWorld();
        return retVal;
    }

}

 

 

Now I generated wsdl and used it in another .Net Web Application on code behind of button click I am calling APEX Method which will in turn call other WebService written in .Net

 

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                SforceService sfs = new SforceService();
                sfs.Timeout = 90000;

                LoginResult lr = sfs.login("username", "passwordtoken");

                HelloWorldService hws = new HelloWorldService();
                hws.Timeout = 90000;
                
                hws.SessionHeaderValue = new TestWebCSharpWebService.SessionHeader();
                hws.SessionHeaderValue.sessionId = lr.sessionId;

                TextBox1.Text = hws.sampleCSharpWebServiceCall();

            }
            catch (SoapException ex)
            {
                TextBox1.Text = ex.Message;
            }

     }

 


But it is showing following error:-

 

System.CalloutException: IO Exception: Read timed out
Class.TestWebServiceForAPEX.Service1Soap.HelloWorld: line 28, column 13
Class.HelloWorld.sampleCSharpWebServiceCall: line 33, column 15
External entry point

rao6308rao6308

@ All

 

I have seen this issue in the past.

If there is any firewall that is blocking the External webservice from being exposed to Salesforce when SFDC tries to hit the Webservice endpoint then the  System.CalloutException: IO Exception: may occur.

 

Easy way to test if the webservice is exposed :

 

Try accessing the endpoint SFDC Trigger/Class is trying to hit from your home network or any network than the work network. If it does not time out then it accessible to the external system.

 

The webservice has to exposed globally to salesforce.

 

Hope this helps

AshyAshy

Hi 

 

jus got the same issue here!

shud i ask my client end to check for it? 

AshyAshy

 

Hi  Albert,

 

jus got the same issue here!

 can u just me out with it?

 

 

please

Thanx in advance

Ashy

 

AshyAshy

Hi Nikki,

 

i just got the same issue can u help me out  with it!

 

Thanx

 

Ashy

AnzarCRMAnzarCRM

Hi,

 

I just got the same issue calling an external web service.

 

IO Exception: Read timed out

 

All the best,

 

Anzar.

SFDC-vishnuSFDC-vishnu

Hi, Even i am getting same exception when i am trying to access the external webservice.

 

let me know the solution ,if any 1 has

 

thanks ..

SFDC-vishnuSFDC-vishnu

Hi Niki,

 

Could you please let me know the  solution please if you have .

 

i am trying to integrate salesforce with the Sharepoint I am sending the HTTP req(SOAP) call to the webservice .

 

which leads to readtimeout exception

muralikrishna.sfdcmuralikrishna.sfdc

In batch class processing i am getting

 

 

IO Exception: Read timed out  , can you help me 

SalesforceDeveloper333SalesforceDeveloper333

Same here.. if any one knows the solution to this please post.

sfdcFanBoysfdcFanBoy
Same Error! Solution please. I have set the timeout to max (100000), but still no response.
Christopher D. EmersonChristopher D. Emerson
Same here (2019) - anyone ever find a solution? My timeout is at the max (120000) but no matter how many records I put into the scope at once I get this "System.CalloutException: Read timed out" error.