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
king kpking kp 

Throwing the Error is Internal Server Error,Status Code :500 Httpreponse

Hi Friends ,

I have to Integrate Salesforce to External Services 

Throwing the Error Is "Internal Server Error",Status Code :500 " Htttpresponse

External Services Has asking the JSON Format  in this Place Creating the XML Format How To resolve this Could Please Help me.

global class ResponseclsforFIC{
    public static void Responsefrom3rdparty(string syncid){
      String endPointURL = '';
      String userName = '';
      String password = 'Kull@i12345';
      // Specify the required user name and password to access the endpoint 
      // As well as the header and header information 
      Blob headerValue = Blob.valueOf(userName + ':' + password);
      String authorizationHeader = 'BASIC ' +EncodingUtil.base64Encode(headerValue);

        DOM.Document resDoc = new DOM.Document();        
            // Send the request
        HttpRequest req = new HttpRequest();   
     //   req.setTimeout(120000);         
        req.setHeader('Authorization', authorizationHeader);
        sfdcFICxmlcreator genrate = new sfdcFICxmlcreator();
        String xml = genrate.xmlgenrate(syncid);
        req.setHeader('content-type', 'application/; charset=utf-8');
         System.Debug('......... Body ...........'+xml);
        Http http = new Http();
       Transient HttpResponse res = new HttpResponse();
        res = http.send(req); 
          //HttpResponse res = http.send(request);  
           res = http.send(req); 
        Contact sfintegrate = new Contact();
         insert sfintegrate ;
      }catch(Exception e){

Pruthvi KankunthalaPruthvi Kankunthala
Open your URL it through normal IE . I think that URL will be prohibited..and restricted that's why it occurs. Also, you have to get registered the endpoint URL in the Remote Site Settings whitelist. 
king kpking kp
Hi Pruthvi Kankunthala,

Thanks For your Reply now Throwing the Error Is: Bad Request And Status COde:400
User-added image

"attributes" : { "type" : "Account", "url" : "/services/data/v37.0/sobjects/Account/0012800000mKa3SAAS" },
"OraganizationName__c" : "kullai",
"Rating" : "Hot",
"Type" : "Prospect",
"Id" : "0012800000mKa3SAAS"

This is the i have to Creating the JSON Format.But External Services Showing the This Type Of format

Content-Type: { "OrganizationName": "Pinnacle Inc",
"PrimaryAddress": [{ "AddressLine1": "500 oracle parkway",
"City": "Redwood Shores",
"State": "CA",
"Country": "US" }] }

  please Help Me Pruthvi Kankunthala