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
GerhardNewman2GerhardNewman2 

Unable to parse callout response

I need to retrieve a file from S3 using apex. 

 

I'm getting this error when using the GetObject method in the Force.com Toolkit for Amazon Web Services

 

System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://s3.amazonaws.com/doc/2006-03-01/=Status

 

 

Prajapati.LakhanPrajapati.Lakhan

Hi,

 

How did you resolve it? I am facing the same problem, please share the fix.

 

Thanks,

Lakhan

GerhardNewman2GerhardNewman2

I changed the architecture of the project I was working on to get around the issue.

I do however use S3 for lots of things including pulling TXT and XML files from S3 into Salesforce.  Code sample:

 

    public static string getS3TxtFile(String fromBucket, String fromKey)
    {
        // Use a simple http get to retrieve a text file from S3
        // The file must be PUBLIC access
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://s3.amazonaws.com/'+fromBucket+'/'+fromKey);
        req.setMethod('GET');
        Http http = new Http();
        HTTPResponse res = http.send(req);
        System.debug(res.getBody());
        return res.getBody();       
    }