0

We are using a HTTP Restful Outbound Webservice which was working fine for 2 years but suddenly stopped working which we are not able to understand the reason. It's giving below error.

System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found"

It looks like Firewall issue to us, but our internal Network team is claiming that, the inbound request from Salesforce is not reaching our Firewall as per logs though IP's provided by Salesforce are correctly whitelisted. But this is working in Sandboxes so we don't think it's Salesforce issue. I would like to know if there is a tool or by any means, can we ping our ESB servers from Salesforce instance?

public class postCall(String siebelId ){

        Http h = new Http();
        HttpRequest req = new HttpRequest();
     req.setEndpoint('https://esb.ent.abc.org/ServiceRequest');
        req.setMethod('POST');
        req.setBody('{"ocl:accountId":"'+siebelId+'"}');
        req.setHeader('Token', '9fdb3ab5-efc8-473f-bc5e-a474b0b9d1e2');
         HttpResponse res = h.send(req);
        System.debug(res.getBody());
 }
3
  • Comments are not for extended discussion; this conversation has been moved to chat. – Adrian Larson May 25 '17 at 15:06
  • This cannot be a Salesforce issue. This is a network connectivity issue. Can you run a netstat to see what is the result are you able to ping the URL. Is it a post or get call. Are you able to use Postman or SoapAPI to test that? – Avijit Chakraborty May 25 '17 at 15:30
  • Salesforce is hosted in cloud so how to use Netstat command in this case? We have implemented HTTP request POST method in our code and when it hits webservice, it's recieving 'HTTP/1.0 404 Not Found' error. But Network team says they don't see any inbound request in logs. – Amulya May 25 '17 at 17:26
0

From the Salesforce instance, you can use a script which mimics this request in a VF or lightning component:

Before any Visualforce page, Apex callout, or JavaScript code using XmlHttpRequest in an s-control or custom button can call an external site, that site must be registered in the Remote Site Settings page, or the call fails.

To enable corresponding access for Lightning components, create a CSP Trusted Site.

For example:

var request = new Request('https://esb.ent.abc.org/ServiceRequest');

fetch(request, {
    mode: 'cors', 
    method: 'POST',
    body: '{"ocl:accountId":"'+siebelId+'"}'
    credentials: 'include',
    headers: {
             'Authorization': 'Bearer TOKEN'
             'Token': '9fdb3ab5-efc8-473f-bc5e-a474b0b9d1e2'
             }
}).then(function(response) {
    document.title = JSON.stringify(response);
}).catch(function(error) {
    document.title = 'Request failed:  ' + JSON.stringify(error)
});

You need to setup CORS headers on your endpoint for this to work.

References

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.