public class HttpCalloutSample {
// Pass in the endpoint to be used using the string url
public String getContent(String url) {
// Instantiate a new http object
Http h = new Http();
// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
// Send the request, and return a response
HttpResponse res = h.send(req);
return res.getBody();
}
}
public class HttpCalloutSample {
// Pass in the endpoint to be used using the string url
public String getContent(String url) {
// Instantiate a new http object
Http h = new Http();
// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
// Send the request, and return a response
HttpResponse res = h.send(req);
return res.getBody();
}
}
There in normal or abnormal Apex. Callout is basically use a set of Apex classes used to callout to external system. There are twoways of callout Rest and Soap.
Rest class include: HttpRequest, HttpResponse, Http etc. Soap are defined by parsing wsdl in Apex. A simple caalout has already been given in post above.
You can perform callout as Please go through http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_callouts.htm for more information.
Thanks,
N.J
All Answers
You can perform callout as Please go through http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_callouts.htm for more information.
Thanks,
N.J
Rest class include: HttpRequest, HttpResponse, Http etc.
Soap are defined by parsing wsdl in Apex. A simple caalout has already been given in post above.