user179056
user179056

Reputation: 614

Adding file in S3 from salesforce using S3 API

I have installed AWS S3 toolkit on sdfc. I have the following code where AWS_S3_ExampleController is part of the installed toolkit. When i execute this code the debug log shows the generic "internal Server error" 500.

The returned soap message has

soapenv:Value>ns1:Client.InvalidArgument soapenv:Value soapenv:Code soapenv:Reasonsoapenv:Text xml:lang="en"Invalid id /soapenv:Text/soapenv:Reason soapenv:Detail ArgumentValue>SAmeer Thakur ArgumentValue>ArgumentName>CanonicalUser/ID/soapenv:Detail>soapenv:Fault> soapenv:Body>soapenv:Envelope>

I do not know how to resolve the Invalid id being seen

     AWS_S3_ExampleController c = new AWS_S3_ExampleController();
        c.constructor();
        c.fileName=fileName;
        c.OwnerId='Sameer Thakur';
        c.bucketToUploadObject= bucketName;
        c.fileSize=100000;
        c.fileBlob= Blob.valueOf(record);
        c.accessTypeSelected='public-read-write';
        System.debug('Before insert');  
        c.syncFilesystemDoc();
        System.debug('After insert');  

Any pointer would be appreciated Thank you Sameer

Upvotes: 1

Views: 981

Answers (1)

user179056
user179056

Reputation: 614

The problem was i needed to define ownerid with canonical value. This value is generated using access key and secret key.

The url to generate canonical user id value is @ http://www.bucketexplorer.com/awsutility.aspx

regards Sameer

Upvotes: 3

Related Questions