• sony sonu
  • NEWBIE
  • 64 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 5
    Likes Given
  • 22
    Questions
  • 46
    Replies
any body working in platform caching in salesforce???????
public class AnimalsCallouts {
    public static HttpResponse makeGetCallout() {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
            // Deserializes the JSON string into collections of primitive data types.
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            // Cast the values in the 'animals' key as a list
            List<Object> animals = (List<Object>) results.get('animals');
            System.debug('Received the following animals:');
            for (Object animal: animals) {
                System.debug(animal);
            }
        }
        return response;
    }
    public static HttpResponse makePostCallout() {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        request.setBody('{"name":"mighty moose"}');
        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());
        }
        return response;
    }        
}
HOW TO CREATE A VISUALFORCE PAGE FOR THIS APEX CLASS??? WITH TWO BUTTONS OF POST AND GET????
THANKS >>>
 
public class restapijava{
 
     public void add(){
      integer x = 10;
       integer y =20;
        integer z = x+y;
        system.debug(z);
    }
    
    
    public static void main(string[] args){
    
        restapijava referncer = new restapijava();
             referncer.add();  
    }
 }
 how can i call it in the anonymous window..??
 

All i need to get response  from sap application through the rest callouts . When i tried to use the Chrome APP 'Advanced Rest Client' and  postman have passed the appropriate URL and Content  with  GET AND POST method I was able to retrieve the values from local server database.
For EG : If i pass request  92126 then i was able to get response  '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.

1)i had created a remotesite setting 
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]
# as the web api url  which is provided to us is in local sql  server i.e  hosted in private,  as we know  THAT salesforce for making callouts the urls must be EXPOSED  in public... bt the url is in private only for the security reasons not hosted in public..we should achieve iT COMPULSARY THERE WILL A ANY SOLUTION FOR ALL THE QUESTIONS   .. IS any way is there to acheive it ??  ..what changeS  should be done in salesforce or LOCAL server to communicate to eachother ..and allows to make the callout ???
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.
hi folks,
 actually out cilent requirement is to connect the local server from salesfroce and make the callouts .. actually localserver is private right so it wont allows the localserver to connect with the local server ..any alternative procedure..they are ready to provide all the data for connecting to local server to salesforce...  any idea about that please let me know... 1st we want to connect to server ...for eliminating the 503 service unavailble error///..
there will be the alternate procedure with the experts..please let meknow
public class Callouts {
    public  static pageReference  makeGetCallout() {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://www.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
        request.setMethod('GET');
    
         
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
            // Deserializes the JSON string into collections of primitive data types.
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
      
            List<Object> values = (List<Object>) results.get('values');
            System.debug('Received the following values:');
            for (Object value: values) {
                System.debug(value);
            }
        }
        return null;
    }
    public static pageReference makePostCallout() {
    String S ='{"Deduction": [{"Cxatxegoxry_Tyxpe": "xV","xxx": 125.00}],"isOxxnlinexxxxxr": true}';   
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(' http://xxxxxxxxxxxxxxxxxxxxxxxxxx');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        
           request.setHeader('ip', '2xxxxxxxxxx');
        request.setBody('S');
        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());
        }
        return null;
    }        
}


v.f page is :
<apex:page controller="Callouts" > 
                   <apex:form >
                <apex:pageBlock >
   <apex:pageBlockSection >
       <apex:commandButton value="GET" action="{!makeGetCallout}"/>
       <apex:commandButton value="POST" action="{!makePostCallout}"/>
          </apex:pageBlockSection>
       </apex:pageBlock>
   </apex:form>

</apex:page>



iam not getting the response on clicking the button may i know where is the mistake?
 
Our SF team was consuming a third party API, but without change in any code the response returned now is 
Unable to tunnel through proxy. Proxy returns "HTTP/1.0 503 Service Unavailable"

The API is actually not receiving any request on the server side, so they are unable to help. Thus asking if someone else has had a similar issue and a viable solution for the same.
Hi All,
I am able to succesfully connect to below URL using SOAP::Lite
http://login.salesforce.com/services/Soap/c/13.0
but I get 503 service unavailable error when I try to connect to https://login.salesforce.com/services/Soap/c/13.0 .
What can be the reason?


Thanks
Bhushan
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.ccc.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.ccc.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.ccc.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
Hi,

We'd like to be able to query some of our Salesforce data from our front-end web app in order to get some information back for the current application user. Specifically we would like to query Salesforce based on a contact role email address in order to determine what Salesforce accoutn they are associated as well as retrieving information from related account opportunities. 

Thanks, Paul

Hi All,

 

I have provided the endpointurl as http://localhost:3590/OMSite/AccountNotificationService.asmx to send the outbound message from salesforce to my local webservice, but it's giving 503 service unavailable error.

 

Please help!!

 

 

We have tight integration between Salesforce and a custom built .NET web appication.  We have one security requirement where I need to call from Salesforce a web service that is hosted on our internal web application.  As part of this call I need to pass the SessionId and UserId of the Salesforce user.  The service will then need to make a call back to Salesforce to validate the session id is active for the specified user before it will perform the requested action.  If the session id is not valid the service would simply return an error code.

 

I am open to any suggestions, but my first thought was to create an APEX class with a Webservice method that will allow an inbount call with the session id and user id and the service will return true or false depending if they are valid. 

 

webService static Boolean validateSessionId(String strUserName, Id idSession)

 

However, I am not sure what code is necessary to be able to determine if the session id and user id are valid.  Please let me know if anybody has thoughts on this.

 

I basically just need code to validate that a given session id and user id is currently active and valid.

 

Thanks for your help