使用WSO2 ESB S3连接器删除S3文件

时间:2018-07-07 16:03:56

标签: amazon-s3 wso2 esb

在尝试使用WSO2 ESB连接器删除驻留在Amazon S3中的文件时遇到问题。这是我所做的: 1)使用来自WSO2 documentation的以下内容,在WSO2 ESB中创建了代理服务:

2)我确保将代理服务部署到WSO2,然后使用POSTMAN 3)我向POSTMAN提交了以下内容:

<deleteObject>
<accessKeyId>MYACCESSKEY</accessKeyId>
<secretAccessKey>MYSECRETKEY</secretAccessKey>
<methodType>DELETE</methodType>
<contentType>application/xml</contentType>
<expect>100-continue</expect>
<region>us-east-1</region>
<host>s3.amazonaws.com</host>
<bucketUrl>http://s3.amazonaws.com/MYBUCKET</bucketUrl>
<bucketName>MYBUCKET</bucketName>
<isXAmzDate>true</isXAmzDate>
<objectName>FILETODELETE.txt</objectName>
<versionId></versionId>
</deleteObject>

我收到以下错误消息(消息开头):

<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature  you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>MYACCESSKEY</AWSAccessKeyId>
<StringToSign>AWS4-HMAC-SHA256
Sat, 07 Jul 2018 15:25:18 GMT
20180707/us-east-1/s3/aws4_request
618b0c822492e3dd2a8f4d9e1ea</StringToSign>   <SignatureProvided>06b2b268cb90b69a1c5dadbb689ed4ccf7b459ff1b5</SignatureProvided>
<StringToSignBytes>BUNCH OF NUMBERS</StringToSignBytes>
<CanonicalRequest>DELETE
/MYBUCKET/xxxxx.txt/

content-type:application/xml
host:s3.amazonaws.com
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-date:Sat, 07 Jul 2018 15:25:18 GMT
content-type;host;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD</CanonicalRequest>
<CanonicalRequestBytes>BUNCH OF NUMBERS</CanonicalRequestBytes>
<RequestId>SOODEDIBD</RequestId>
  <HostId>vLllBSaWMHkV+gqX6yh7+43WK4PsAO4VVXLdGePBvGWZtxxExbBqI=</HostId>

我重新创建了S3凭据,但仍然遇到相同的错误,将不胜感激任何帮助。

坦率

1 个答案:

答案 0 :(得分:0)

在通过S3的删除对象之后,您需要检查标头值是否正确,因为访问Web服务之前需要进行身份验证,标头应如下所示。

DELETE /my-image.jpg?versionId=3HL4kqCxf3vjVBH40Nrjfkd HTTPS/1.1
Host: bucketName.s3.amazonaws.com
x-amz-mfa: 20899872 301749
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: AWS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=

您可以将wso2 esb置于调试模式,并确认是否在适当的标头处传递了该标头,否则请使用TCPDUMP进行准确