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
Shri RajShri Raj 

REST API Integration ERROR.

Hello All,

I will try to frame my question in short.

End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)

SUCCESS Through Chrome APP
1.  All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct. 

Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.


PROBLEM from Salesforce :

2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error. 

System.HttpResponse[Status=Service Unavailable, StatusCode=503]

public with sharing class LmsRestApiIntegration {

//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.csaa.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.csaa.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.csaa.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();

System.debug('Response :'+response);

}
}

Please guide.

Thank You
Shri
Avidev9Avidev9
Can you please switch to https instead of http ?
May be its getting blocked because of the same
Shri RajShri Raj
Hello Avi, I did tried that, The end point is in HTTP. not in HTTPS. It was not able to find the path. It should be something else which I'm unable to figure out. I have also updated the Remote Site Settings in Salesforce.