-1

My goal is to create a REST API Integration from Salesforce to SAP application.

SUCCESS Through Chrome APP

1. All I need to do is retrieve values from sap application through the REST API. When I tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content with POST method I was able to retrieve the values from local server database.

For EG : If I pass request 92126 then I was able to get response  'SAN DIEGO' which is correct.

Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US) for Advanced REST Client.

PROBLEM from Salesforce :

  1. I had created a remotesite setting 
  2. When I created this REST class in SAlesforce and tried invoking the End Point then it's throwing this error.

System.HttpResponse[Status=Service Unavailable, StatusCode=503]

As the web api url which is provided to us is in local sql server i.e hosted in private, as we know in Salesforce for making callouts the URLs must be in public. But the URL is in private only for the security reasons not hosted in public. We should achieve it, any way is there to achieve it? What change should be done in Salesforce or server to communicate to each other, and allows to make the callout?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer May 07 '18 at 17:54

1 Answers1

3

It is most likely that you endpoint does not allow access from outside some ip range which you indicated by saying it's not public. Salesforce is a SaaS application hosted outside the domain that your service is on. In order for Salesforce to access that endpoint resource you need to whitelist Salesforce IP ranges, which can be found here.

Whitelisting allows Salesforce to access the resource. The only caveat is that because Salesforce is multi-tenant it means that any instance of Salesforce on the range that you whitelist would have access to your endpoint. If this is not ok, you might want to add some sort of header or sign the request to the call to that identifies your Salesforce instance uniquely from any other instance to validate that the call originated from your Salesforce org.

(I am linking to the article instead of pasting the IP ranges here because these may change in the future).

Gareth Jordan
  • 968
  • 1
  • 6
  • 10
  • Hi Gareth. This is a very brief answer, and is a link only, so is likely to be deleted by the Review Queue. We very much value answers here that are more than a link, and are more substantive than just a few words. Can you expand on this, and explain how it answers the question? – halfer May 07 '18 at 17:53
  • Thank you for the edit, Gareth - much better and +1. I happened to chance across it - I recommend replying to requests for changes, as it it may get you more upvotes. – halfer May 07 '18 at 22:42