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

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 5
    Likes Given
  • 22
    Questions
  • 46
    Replies
this header is different

the original template of salesforce is :User-added image

may i know why iam not getting the standard header in salesforce
need  a visualforce page , when salesforce user enters his credentials and password , we can able to fetch users necessary  data from  all salesforce orgs.. 
 
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..??
 
hai,,,,thinking to have  have to talk to your network engineers and have them whitelist a range of Salesforce IP ranges ..See the following document:

 All i need to do is retrieve values from external application . When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL format in the form of POST methoed I was able to retrieve the values from local server 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]


saved the url site in remote site setting also,, as salesforce ip address are dyamically changing everytime ....our network engineers are refusing to add/whitelist too many ip address in the local server.. instead they are asking to provide 2 ip address ..what will be your suggestion ...
https://developer.salesforce.com/forums/?id=906F0000000Af3aIAC

i have the problem with the same scenario in rest callouts ,, as in the comments they had  suggested to add /whitelist the salesforce ip address , to the network engineers ..so there are so many ip ranges in the salesforce because it is static ...as we are using ap5, they are willing to add the 2 static ip address in the server ..may i know how to resolve this issue... there are so many ip address with ranges ,?? what will be the solution to suggest the network engineers..
<apex:page>
    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="  crossorigin="anonymous"></script>
    
    <script>
    
        function Callout()
        {
            var JSONResponse = '';
            var JsonBody = '';
            JsonBody = '{"capital ": "delhi"}';
            
            
            
            
            console.log('--JsonBody ------->'+JsonBody );
            
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "http://myendpointxxxxr", true);
            <!-- xhr.setRequestHeader("Authorization","Bearer {!AccessToken}" ); -->
            xhr.setRequestHeader("Content-type", "application/json;charset=UTF-8");
            
            xhr.onload = function () 
            {
                JSONResponse = xhr.responseText;
                console.log('--JSONResponse ------->'+xhr.responseText);
            };
            xhr.send(JsonBody);
            setTimeout( function()
                {
                    if(xhr.status == 404){                     
                    }
                    else if(xhr.status == 401){
                    }
                    else if(xhr.status == 500){
                    }
                    else if(xhr.status == 200)
                    {
                        obj1 = JSON.parse(JSONResponse );
                        for(var x=0;x< obj1.length;x++)
                        {
                            var singleEle = obj1[x];
                            console.log('--singleEle ------->'+singleEle );
                        }
                    }
                },
            2000);
        }
        
    </script>   
    
    <apex:form>
        <apex:pageBlock>
             <apex:pageBlockButtons location="Top">
                <button type="button" onclick="Callout();" style="height:22px; width:150px" > 
     Make Callout 
                </button>
             </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
    
</apex:page>

iam getting the below errror :Failed to load resource: the server responded with a status of 404 (Not Found). any wrong in the code

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
procedurce for ther authentication with salesforce to private server 
for making rest callouts to external application by using webapi which is hosted in private , for this salesforce should authenticate with the local server..then how to authenitcate both ..???? the server is locallay hosted..
Hello Everyone,

While doing an integration with SAP there are firewall and local server  issues.To avoid this they were asking me the salesforce  static IP for my organization.

So how can i know the IP Address of my instance, its a developer org. Is it possible to find by salesforce logged in URL? i had gone through the below link ,
https://help.salesforce.com/apex/HTViewSolution?id=000003652
APAC, you need to whitelsit these IP ranges

182.50.76.0 - 182.50.79.254
202.129.242.0 - 202.129.243.254
96.43.144.0 - 96.43.159.254
136.146.0.0 - 136.147.255.254
204.14.232.0 - 204.14.239.254

these are all  whitelsit these IP ranges, but  i need the static address to add in the local server .for the accessing the local server for callouts coming form the ip address as they added...
Please suggest me with your ideas, Thanks in advance.
Hello Folks,

As am doing an integration with SAP which is hosted on local server, Netowrk team asking me about IP's and Port's.
Already provided IP Addresses but not able to provide Port numbers. So how can i know the port number for my instance( https://ap5.salesforce.com )

Your help is higly appreciated, Thanks in advance.
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?
 
which edition is best for the rest api callouts  multiple and more number of callouts form salesforce to external application ...professional or enterprise edition ???
 let me know why???
System.CalloutException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.

Is developer edition is already tls1.1  and tls1.2  enabled....or any other way to enable it in develpr org??
System.CalloutException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.

may i know how i can be acheived in developer edition ??????
Environment :  developer edition
I am using callout to pull the data from api to Salsesforce. It was working bfore.  Today I ran the apex callout and got the following error
System.CalloutException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client
Then I checked Internet about this error and came to know that salesforce disabled TLS 1.0. I also got some information TLS 1.0 Disablement Critical Update Console (CRUC) Setting. But unfortunately am not able to see that Require TLS 1.1 or higher for HTTPS connections in CRUC.
how many callouts can we make form the salesforce to other application say .net ..and what happends if limits exceeds form salesforce callouts..any idea???
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

 

 

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 ble to succesfully connect to http://login.salesforce.com/services/Soap/c/13.0 through SOAP::Lite while I get 503 service unavailable URL.
Any idea what can issue?
Is it correct ebhaviour, is it fine if we use http over https, will SF support?
I'm trying to figure out a way how to have my outbound API calls from Apex always come from the same IP address. The API I'm calling is out of my control and the provider is refusing to whitelist the whole Salesforce IP range. Instead they require me to provide a single IP or a single range of 255 addresses for them to whitelist. SSL certificate also has to be used.

Is there any way to achieve this from apex. Can you suggest a workaround on how to achieve this? Any help will be appreciated.
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

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