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

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



  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!



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


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();
// 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



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: