Hi Rasika,
Is there a reason for sending a SOAP request to a REST API?
According to Amazon S3 REST API documentation [1] I think the request
should be a HTTP PUT call similar to this containing the JSON in the
message body:
PUT /?policy HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Tue, 04 Apr 2010 20:34:56 GMT
Authorization: authorization string
{
"Version":"2008-10-17",
"Id":"aaaa-bbbb-cccc-dddd",
"Statement" : [
{
"Effect":"Allow",
"Sid":"1",
"Principal" : {
"AWS":["111122223333","444455556666"]
},
"Action":["s3:*"],
"Resource":"arn:aws:s3:::bucket/*"
}
]
}
[1] http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTpolicy.html
Best Regards,
Imesh
On Fri, Jan 31, 2014 at 7:34 AM, Rasika Hettige <[email protected]> wrote:
> Hi,
>
> In AmazonS3 REST API, "PUT Bucket policy" method expects a dynamic JSON
> array to create bucket policies.
> Is it a best practice to send dynamic JSON array through SOAP request as
> below?
> Please note that the policies change from each other and does not have a
> fix
> nature.
>
> Please guide us, if the following way is not a good practice.
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> "
> xmlns:urn="wso2.connector.amazons3.createbucketpolicy">
> <soapenv:Header/>
> <soapenv:Body>
> <urn:accessKeyId>AKIAIGURZM7GJ7TRO6KQ</urn:accessKeyId>
>
>
> <urn:secretAccessKey>asAX8CJoDKzeOd0Ve5dMCFk4STUFDRHkGX6m0CcY</urn:secretAccessKey>
> <urn:methodType>PUT</urn:methodType>
> <urn:contentType>application/json</urn:contentType>
> <urn:bucketName>imagesBucket5</urn:bucketName>
> <urn:xAmzDate>true</urn:xAmzDate>
> <urn:bucketUrl>http://s3.amazonaws.com/imagesBucket5</urn:bucketUrl>
> <urn:uriRemainder>/?policy</urn:uriRemainder>
> <urn:bucketPolicy>{
> "Version":"2012-10-17",
> "Statement":[
> {
> "Sid":"Policy1",
> "Effect":"Allow",
> "Principal": {
> "AWS": "*"},
> "Action":["s3:GetObject"],
> "Resource":"arn:aws:s3:::imagesBucket5/*",
> "Condition":{
> "StringLike":{
> "aws:Referer":[
> "http://www.example.com/*",
> "http://example.com/*"
> ]
> }
> }
> }
> ]
> }</urn:bucketPolicy>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
>
> --
> View this message in context:
> http://wso2-oxygen-tank.10903.n7.nabble.com/Pass-JSON-array-through-SOAP-Request-tp91556.html
> Sent from the WSO2 Development mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
--
*Imesh Gunaratne*
Technical Lead
WSO2 Inc: http://wso2.com
T: +94 11 214 5345 M: +94 77 374 2057
W: http://imesh.gunaratne.org
Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev