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
satheeshrsksatheeshrsk 

How to call an external webservice api from apex through HTTP Call outs

Hi,

 

  This is kumar, I’m new to salesforce. I need to call an external application from Apex through HTTP Call outs. Could any one send me the sample code, how to parse and call (invoke) external application(wsdl). Any help must be appreciated .

 

 

Thanks inadvance!

Kumar

*werewolf**werewolf*

Here's one example from the cookbook (using Docusign's WSDL).

TechiesTechies

hope this will help you

 

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();
before this you have to add the respective external URL to remote site settings.. then only the process will success
Regards,
Kiran

 

Pradeep_NavatarPradeep_Navatar

To access the external webservice in salesforce is not complex task. First you need to parse your wsdl  and create stub classes from wsdl.


For that goto--> setup--> AppSetup---> Develope--> classes--> click on 'Generate from wsdl' button.


From here you can parse your wsdl and create stub classes in apex. Now using these classes you can make callout to external webservice. For more information go through the below link:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_callouts_wsdl2apex.htm
http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts