1

I am trying to access a SAP server : http://10.*.*.*:7110

I have already setup this URL in Remote setting.

When I am trying with SOAP UI it is working fine that suggests End Point is valid. But, I know SOAP UI or browser takes it's own IP address, that's why it's working.

But when we try to call via Apex code, Salesforce server IP address involves.

Any idea, how to solve 403 issue?

Script :

String jsonRequest = 'JSON String'; 


String requestBody = JSON.serializePretty(jsonRequest);
HttpRequest req = new HttpRequest();
HttpResponse response = new HttpResponse();
Http myHttp = new Http();
String endpoint = 'http://10.*.*.*:7110/api/***/****';

req.setEndpoint(endpoint);
req.setMethod('POST'); 
req.setBody(requestBody);
req.setHeader('Content-Type', 'application/json'); 

response = myHttp.send(req);

`

DEBUG|DEBUG: http status -- 403 -- Forbidden

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: *******************

Access Denied.

Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.

Your cache administrator is

  • Can you try adding https as well ? – karthikselva Mar 1 '16 at 17:09
  • They have implemented http only, as it will be called internally and more over we have to be in VPN to call this server. – SFDC Geek Mar 1 '16 at 17:50
  • I am wondering if this could be related to a particular machine(in this case, yours). Could you try in a different PC? – San Tosh Mar 1 '16 at 18:03
  • you could try some of the tricks like flush your DNS in CMD or clearing your browser cache. – San Tosh Mar 1 '16 at 18:05
  • I tried with browser by using in build browser tool to send the request and got the response. So my guess is , salesforce server has some restriction. – SFDC Geek Mar 1 '16 at 18:08
1

It might have something to do with the 10.0.0.0/8 block (10.0.0.0 - 10.255.255.255) being defined as private address space by the IANA (Internet Assigned Numbers Authority).

To make your callout work, you'll need to have a public (and static) IP address either assigned to a network interface on the machine that you are calling out to, or have a proxy of some sort sitting on the edge of the network which can route requests to the machine in your internal network.

In other words, your callout can't use 10.x.x.x as an endpoint.

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.