I am working on an Integration project. The communication is between an external database and Salesforce.
The Goal is -
- To Send a request from Salesforce to the external Database -Get the response in JSON and display the respose in Salesforce UI
Note: We will not be storing the Data from oracle db in Salesforce only diplaying it .
This is my first integration project. I did the trailhead module on integration, and did some research.
The steps as I understand are these
1. Register a new site (Setup > Remote Site > Enter the URL of the remote site)
2. Develop Apex Class to make a http callout
Http httpProtocol = new Http();
HttpRequest request = new HttpRequest();
String endpointurl = 'https://webaddressofsitetobecalled';
request.setEndPoint(endpointurl);
request.setMethod('GET');
HttpResponse response;
response = httpProtocol.send(request);
3. Develop an Apex Class for HMAC Signature
global class HMAC {
public static void generateSignature() {
String salt = String.valueOf(Crypto.getRandomInteger());
String secretKey = 'MY$%^$^%$&$&Secret*^*&%&^%^$%^$KEY@$#@$#@';
String signature = generateHmacSHA256Signature(salt, secretKey);
System.debug('Signature : ' + signature);
}
private static String generateHmacSHA256Signature(String saltValue, String secretKeyValue) {
String algorithmName = 'HmacSHA256';
Blob hmacData = Crypto.generateMac(algorithmName, Blob.valueOf(saltValue), Blob.valueOf(secretKeyValue));
return EncodingUtil.base64Encode(hmacData);
}
}
4. Create a new Apex Class from WSDL
// This is the part I am not clear about // Setup > Apex Class > Generate From WSDL > Choose File (How do i generate this file ?) > Parse WSDL
Can someone please guide me?
- Am i on the right track?
- Am i missing something ?
- Where do I start and how do I proceed?
Thanks!