0

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?

  1. Am i on the right track?
  2. Am i missing something ?
  3. Where do I start and how do I proceed?

Thanks!

  • 1
    Essentially you are just writing your own Apex client. There is no reason to attempt to write the client until you understand the API you are consuming. Start out using a generic client such as cURL or Postman... understand the SOAP payload, headers, etc that Oracle API requires. Once you are successfully writing/reading Oracle via API, then move on and write your client. We will be in a better place to assist you with any specific questions about Salesforce.com and/or Apex. – krigi Apr 26 at 20:08
  • I have first-hand experience with these Oracle API(s), even the so-called modern ones (Oracle Fusion). They are typically... um... obtuse. I spent a fair amount of time focused on getting to know the APIs in depth... SoapUI good starting point to consume your WSDLs. If you are already at that point in the show, and you understand the Oracle API(s) in depth... great! Yes, you are on the right track with what you laid out above, although I suggest avoiding using any "WSDL 2 Apex" as they can quickly obscure and add complexity to what is going on. – krigi Apr 26 at 20:14
  • other pointed suggestions: use a Serialization Class that makes sense to you and fits the Oracle response payload. Also, connecting to a SOAP endpoint is nothing more than sending a String body (XML) with some SOAP specific headers. Thinking of your Http callout that way will help you... and using generic SoapUI client will help you understand the XML shape that works with the Oracle endpoints. – krigi Apr 26 at 20:17
  • Thank you for your responses. A correction... by Oracle Database I meant a database that is developed on the Oracle Platform. So basically we will be creating a webservice that Salesforce will consume. – user4947 Apr 26 at 21:26
  • Have you considered using a External Data Source? – Robs Apr 26 at 22:20
-1

We push data from SAP HANA into tableau and use sparkler to push that into a VF page. But what you're doing...

If you want sfdc to consume it as a service then make a WSDL and upload to SFDC, that will create an Apex class for you to use. Now as for getting that to display...

Ehh someone else that knows lightning components can chime in.

  • That's exactly our current solution. However due to some restrictions and limitations, we want to directly integrate with our external data source and have the sync in real time.. – user4947 Apr 30 at 15:55
  • Why not just have the data source push data out in a continuous stream. IE if you're pushing it into tableau as an excel file just have it create a new excel file and overwrite the old one any time there's a change. that way when accessed in sfdc via sparkler it's always up to date? That's what we have going on, so any time a sales employee looks at some of these tableau reports in sfdc they're always up to date. – ensir Apr 30 at 17:00
  • I had suggested that here, however for reasons 'best know' to the business the decision maker decided the best solution was to send api requests to the External System (which is the source of truth), and display the responses in VFP and/or Lightning Component. – user4947 May 1 at 15:42
  • Well you should know if you're doing a soap call to generate that file you have to have the XML WSDL to upload into SFDC, so you'll need that target systems WSDL. Second if you're wanting to call on that database and then push that data into a lightning component for display....ehhhhh... i'm guessing the amount of data is quite large.... Well i'd suggest checking lightning connect out, developer.salesforce.com/events/webinars/Lightning-Connect trailhead.salesforce.com/en/content/learn/modules/… – ensir May 1 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.