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
Henry AkpalaHenry Akpala 

CalloutException on http Callout

I am testing a service with for a project and did the normal setup for the http by registering the url and all that is fine.  But I get a timeout error each time from salesforce...

Http http = new Http();

HttpRequest req = new HttpRequest();

req.setHeader('content-length''120000') ;

req.setTimeout(120000); 

req.setEndpoint('http://jdrf.synegen.com/JDRF/webresources/delete/'+EncodingUtil.urlEncode(strContact, 'UTF-8'));

 

//this is the actual message after decoding

//req.setEndpoint('http://jdrf.synegen.com/JDRF/webresources/delete/%5B%7B%22sfdc%22%3A%22003J0000005NDcsIAG%22%7D%5D');

 

req.setMethod('POST');

HttpResponse res;

System.debug('response:'+ res);

the response that i get is callout timeout

 

System.CalloutException: Read timed out

 



Not sure why i can't get through to the url from salesforce.  I am using a sandbox org. 

I tried the same url from a browser and I get a response back...
"Members were deleted."
Any input will be greatly appreciated
Navatar_DbSupNavatar_DbSup

Hi,

 

It seems you have met with the Callout Limits.

Callout Limits:-

The following limits apply when Apex code makes a callout to an HTTP request or a Web services call. The Web services call can be a Web services API call or any external Web services call.

1. A single Apex transaction can make a maximum of 10 callouts to an HTTP request or an API call.

2. The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 60 seconds. See the following examples for how to set custom timeouts for Web services or HTTP callouts.

3. The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. This time is additive across all callouts invoked by the Apex transaction.

For details please refer to below  Link :

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_callouts_timeouts.htm

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Henry AkpalaHenry Akpala

I doubt it because it is just the first request that I am making.  I am invoking it manually using dev console