开发者

How to put an object on amazon S3 using the SOAP API on windows phone 7?

I'm having a hard time consuming the S3 API on Windows phone 7, mainly because of the lack of example for actually putting an object on S3 using the SOAP API?

Where do you even put the body of the item? As far as I know, there isn't even a field for it in the putObject method...

(PutObjectAsync(string Bucket, stri开发者_如何学Pythonng Key, MetadataEntry[] Metadata, long ContentLength, Grant[] AccessControlList, Exam_Helper.AWS.StorageClass StorageClass, string AWSAccessKeyId, System.DateTime Timestamp, string Signature, string Credential, object userState))

So, how do you put an object on S3 with windows phone 7.


I do not recommend accessing the S3 API (or the Azure Storage API) direct from your phone.

If you try this, then you will need to either have public PUT permissions or you will have your private storage access keys in plain view in the XAP file - it will be easy for a hacker to steal these and you will soon be paying to host PimpMyBreasts, WikiL33ked and SpamThis.

Instead, you should host your own storage service where you can at least put some security checks in about what is being uploaded.

If you do insist on using S3 directly, then this article covers S3 from C# including PutObject requests - http://www.codeproject.com/KB/cs/s3_ec2studio.aspx

Good luck

Stuart


I assume that you added a service reference to the Amazon service in your project:

http://s3.amazonaws.com/doc/2006-03-01/AmazonS3.wsdl

Once added as a service reference, you can invoke AmazonS3Client.PutObjectInlineAsync to upload an object in a S3 bucket. The Data parameter (accepts a byte array) is what you're looking for.

Recommended reading: http://timheuer.com/blog/archive/2008/07/05/access-amazon-s3-services-with-silverlight-2.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜