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
deni kurniawandeni kurniawan 

Integrate Salesforce with Singpost Web service

Hi All
I am making a callout to external webservice and when I try running the class I get error like this System.HttpResponse[Status=Not Found, StatusCode=404]

This is link for singpost web service : https://www.ezy2ship.com/modules/oss/api/ship/wsdl?sz_Client=SingPost.json
This is my Apex Class : 
public class testGenerateTicketCon {
    public staff__c test {get;set;}
    public string thisdate {get;set;}
    public string username{get;set;}
    public string password{get;set;}
    public string customerID {get;set;}
    public string output{get;set;}
    public string input {get;set;}
    public string requestlabel;
    public string result{get;set;}
    public String status{get;set;}
    
    public testGenerateTicketCon()
    {
     username='';
     password='';
     customerID=''; 
     thisdate='';
     status='';
    }
    
    public void startRequest(String ticket){ 
        
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HttpResponse res = new HttpResponse();
        req.setEndpoint('callout:Singapore_Post/getAvailableServicePointsRequest');
        req.setMethod('POST');
        req.setHeader('Content-Type', 'text/xml');
        req.setHeader('Content-Length', '512'); 
        req.setHeader('soapAction', 'https://www.ezy2ship.com/modules/oss/api/ship/index?sz_Client=SingPost.json#getAvailableServicePoints');
  
        res = http.send(req);
        result = res.toString();
       
    }
   
    public void generate()
    {
     thisdate=datetime.now().format('YYYYMMDD');
     input=password;
     string SHA1Coded = EncodingUtil.convertToHex(Crypto.generateDigest('SHA1', Blob.valueOf(input)));
     input=customerid+username+SHA1coded+thisdate;
     blob cryptokey= Crypto.generateAesKey(256);
     Blob data = Blob.valueOf(input);
     Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);
     
     output=EncodingUtil.base64encode(encrypteddata);
     output=output.replace('+','-');
     output=output.replace('/','_');
     output=output.replace('=',',');
     
     startRequest(output);
     }
    
}
If anyone can help me?
ShashankShashank (Salesforce Developers) 
You might want to check the external web service if it is listening properly, if you are still facing this issue.