function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pankaj Singh 196Pankaj Singh 196 

POST Data to Mulesoft from Salesforce using REST API || Getting HTTP/1.1 503 Service Unavailable

Hi All,
I am getting below give error while executing code from execute window in Salesforce.

"System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable" 

**Code :** 

    Http http = new Http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint('https://integration-qa.al-enterprise/presales-qa/post/v1.0/validatePos.com');
    request.setMethod('POST');
    request.setHeader('Content-Type', 'application/json;charset=UTF-8');
    
    // Set the body as a JSON object
    request.setBody('{"posId":"POS_Partner_004"}');
    
    HttpResponse response = http.send(request);
    
    // Parse the JSON response
    if (response.getStatusCode() != 201) {
        System.debug('The status code returned was not expected: ' +
            response.getStatusCode() + ' ' + response.getStatus());
    } else {
        System.debug(response.getBody());
    }

I tried with some other codes as well (having basic auth) but always got same error on this line "**HttpResponse response = http.send(request);**"

I searched over net to resolve it but didn't worked. Kindly help. 
Also help on below points.

1) Do i need to provide signed certificate to Mulesoft.

2) Do i need to put any security certificate in Salesforce received from Mulesoft. Would it be CA signed or Import from Keystore kind.

3) I have already set remote site setting in Salesforce.

4) Proxy opened for all websites.

5) End Point ULR not working in POSTMAN , When checked with Mulesoft they said its because of whitelist issue. There end point URL is perfectly fine.

What is exact way to connect from Salesforce to Mulesoft using REST API and how to POST/GET data.

Thanks Alot!!!

 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Pankaj,

I found the below link that could be similar implementation, can you please have a look at it:

>> https://dzone.com/articles/connecting-salesforce-from-mulesoft

I found the mulesoft forum that you could use please find the link below:
>> https://help.mulesoft.com/s/forum

Regards,
Anutej
Pankaj Singh 196Pankaj Singh 196
Hi Anutej, Thanks for the reply. 
Your suggested link was partially helpful. I got the solution.