You need to sign in to do that
Don't have an account?

Connect Localhost from Apex
Hi Devs,
I want to connect with my localhost .for that i use "http:localhost:9000" in htpprequest in apex. It shows service unavailable error.
Apex is run in salesforce server ,so it doesnt any response to me.
Is there any other way to do this.
Please help regarding this.
//My Http request Http http = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint('http://localhost:9000'); req.setMethod('GET'); req.setTimeout(50000); req.setbody(xmlStringxmlRD); HttpResponse res = http.send(req); system.debug('&&&&res'+res);
my Debug log show as
&&&&resSystem.HttpResponse[Status=Service Unavailable, StatusCode=503]
You are trying to initiate a call from salesforce (publicly hosted) to your local machine (which does not have any public existence). You can only make calls to public IPs from salesforce.