+ Start a Discussion
sony sonusony sonu 

rest callout through salesforce to .net application

Hi, I am requesting a service to the endpoint using REST call.
Now this endpoint url is in client network. We are  passing  URLs in client network which works fine.
i have configured the endpoint under Remote Site settings and trying to send the request as POST AND GET  method to the endpoint via Apex class. I am getting  503 Service Unavailable response and the description of the body says 'Unable to determine IP address from host name'.
Since we this is just a HTTP URL , i tried creating a custom link and tried invoking the URL which works fine within the same app.
So I am not sure when I am able to access the endpoint URL via custom link within the app then why I am unable to access the same endpoint via Apex class?
Any suggestions would be highly appreciated.
Leo10Leo10
Hi, 
Did you check the same with Postman?
sony sonusony sonu
hi  leo, thanks for your reply, yes i checked with postman and advanced rest client both it is working fine, but if we work form the salesforce it is showing the 503 error service un availble...
1st we need to connect with the local server from salesforce ...do you have any solution regarding it
Leo10Leo10
Can I get your code?
sony sonusony sonu
hi ..leo....can you provide your .skypeid or mail id please
Leo10Leo10
nabeelkt11@gmail.com
sony sonusony sonu
<Http http=new Http();
     HttpRequest req=new HttpRequest();
        req.setEndpoint('http://myendpoingurl');
        req.setMethod('GET'); 
        req.setHeader('content-type' ,'application/json');
        HttpResponse res= http.send(req);
          
               if (res.getStatusCode() != 200) {
                   
               System.debug('The status code returned was not expected: ' +
                res.getStatusCode() + ' ' + res.getStatus());              
           }
          else {
                System.debug(res.getBody());  
          }
>
Leo10Leo10
What is your endpoint URL?