I want to call out my web service after the insert process of a custom object with a delay of 2 minutes. But i am getting that exception FATAL_ERROR|System.CalloutException: Read timed out
How can i fix that problem ? Here is my implementation.
Callout class:
public class HttpCallout{
@Future(callout=true)
public static void getContent(String url){
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
req.setTimeout(2000);
HttpResponse res = h.send(req);
String response = EncodingUtil.urlDecode(res.getBody(),'UTF-8');
System.debug('***response****'+response);
}
public void serviceCaller(){
getContent(url);
}
}
Trigger:
trigger AfterInsertOrUpdate on Sales_Order__c (after insert) {
System.debug('Making future call to update account');
HttpCallout httpCallout = new HttpCallout();
httpCallout.serviceCaller();
System.debug('After Insert');
}
Any help would be appriciated.