Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created June 9, 2022 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/cf6ba368dc918cd721c70e3982f9549c to your computer and use it in GitHub Desktop.
Save arun12209/cf6ba368dc918cd721c70e3982f9549c to your computer and use it in GitHub Desktop.
//Call external services registered actions from apex
//Instantiate the external service Apex class
ExternalService.BankService service = new ExternalService.BankService();
//set request
ExternalService.BankService.getAccount_Request req = new ExternalService.BankService.getAccount_Request();
req.accountName = 'DynamicsCorporation';
try{
//make callout
ExternalService.BankService.getAccount_Response res = service.getAccount(req);
system.debug('200 response id => '+ res.Code200.Id);
system.debug('200 repsonse: available balance => '+res.code200.availableBal);
}catch(ExternalService.BankService.getAccount_ResponseException exc){
system.debug('404 response: error message => '+ exc.code404.errorMessage);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment