• Tu Dao
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies

Hi all,

 

  I'm using Force.com toolkit for AWS and i want to get S3 object detais (for example StorageClass). I have updated S3 class to use GetObject method (http://boards.developerforce.com/t5/Apex-Code-Development/Amzon-S3-getObject/m-p/159893#M23555), unfortunately the object returned doesn't have information I need.

 

  Please let me know if you have a solution to this.

 

Thanks

  • December 28, 2012
  • Like
  • 0

Hi all,

 

I implemented a method to upload an Attachment to Amazon S3 but I'm having this issue : AWS authentication requires a valid Date or x-amz-date header

 

Any help is appreciated.

 

Attachment attachment = [Select Id, ContentType, Body, BodyLength from Attachment limit 1];
      //Set<Id> ids = new Map<Id,Attachment>(attachments).keySet();
      AWSKeys credentials = new AWSKeys('Keys');
      S3.AmazonS3 as3 = new S3.AmazonS3(credentials.key,credentials.secret);
      
      Datetime now = DateTime.now();
      String formattednow = now.formatGmt('yyyy-MM-dd')+'T'+now.formatGmt('HH:mm:ss')+'.'+now.formatGMT('SSS')+'Z';
      
      String stringtosign = 'PUT \n\n';
      stringtosign += attachment.ContentType + '\n';
      stringtosign += formattednow + '\n';
      stringtosign += '/mybucket/' + attachment.Id;
      Blob mac = Crypto.generateMac('HMacSHA1', blob.valueof(stringtosign),blob.valueof(as3.secret)); 
      String signature = EncodingUtil.base64Encode(mac);
      
      HttpRequest req = new HttpRequest(); 
 
     //Set HTTPRequest Method
     req.setMethod('PUT');
   
     //Set HTTPRequest header properties
     req.setHeader('content-type', attachment.ContentType);
     req.setHeader('Content-Length',String.valueOf(attachment.BodyLength));
     req.setHeader('Date', formattednow);
     req.setHeader('Authorization', 'AWS ' + as3.key + ':' + signature);
     req.setEndpoint('http://s3.amazonaws.com');
     
      try {
            Http http = new Http();
           //Execute web service call here      
           HTTPResponse res = http.send(req);
         
   } catch(System.CalloutException e) {
      System.debug('===================EXCEPTION ' + e.getMessage() + e.getStackTraceString());
   }  

 

  • December 12, 2012
  • Like
  • 0

Hi guys,

 

When I used Force.com Migration tool to retrieve metadata from a developer org, I got this error : 

Invalid username, password, security token; or user locked out.

 

After checking the configuration, I'm sure that : 

- The username, password & security token are correct because I can use them to checkout a Force.com project in Eclipse.

- Server url is correct (https://login.salesforce.com)

 

Can anybody give me an advice ?

 

Thanks.

  • April 16, 2012
  • Like
  • 0

We are a small non-profit organisation (working to protect children from sex tourism) based in Bangkok. We are about to implement Saleforce and are therefor looking for a a freelancer that would come to Thailand for a couple of days to help us get started.

 

The plan is that you need to work 1 day before arrival (to prepare and get us started with data collection) and 2 days while you are in Thailand (for implementation and training).

 

We are able to pay the air tickets and cover all other expenses for a week in Thailand (only 2 days work) if someone is interested in helping our cause and see a bit of Thailand.

 

We plan to add a line of cloud-based services (elearning, portals, website etc.) on top of the CRM in the next phase. Which is why it is very important that we get a good start and get help from someone who has a greater insight in the Force.com platform.

 

For the right person there could be more (paid) work afterwards.

Hi guys,

 

When I used Force.com Migration tool to retrieve metadata from a developer org, I got this error : 

Invalid username, password, security token; or user locked out.

 

After checking the configuration, I'm sure that : 

- The username, password & security token are correct because I can use them to checkout a Force.com project in Eclipse.

- Server url is correct (https://login.salesforce.com)

 

Can anybody give me an advice ?

 

Thanks.

  • April 16, 2012
  • Like
  • 0