我试图通过wso2 esb amzons3连接器将文件/图像上传到Amazon s3存储桶。 环境:
我在突触配置的amazons3.init部分中收到以下错误响应
<?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>AKIA****</AWSAccessKeyId>
<StringToSign>AWS4-HMAC-SHA256 Wed, 08 Aug 2018 08:23:10 GMT 20180808/ap-south-1/s3/aws4_request 2ee328c3bd863a6b63efd4080bb8dbf8bb6395a1c3c5f3645097e85ec5df933f</StringToSign>
<SignatureProvided>4f634de4f86907028be711c045c39bf9418e1b2159ed6f1ff14316a0dfa94617</SignatureProvided>
<StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 57 65 64 2c 20 30 38 20 41 75 67 20 32 30 31 38 20 30 38 3a 32 33 3a 31 30 20 47 4d 54 0a 32 30 31 38 30 38 30 38 2f 61 70 2d 73 6f 75 74 68 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 32 65 65 33 32 38 63 33 62 64 38 36 33 61 36 62 36 33 65 66 64 34 30 38 30 62 62 38 64 62 66 38 62 62 36 33 39 35 61 31 63 33 63 35 66 33 36 34 35 30 39 37 65 38 35 65 63 35 64 66 39 33 33 66</StringToSignBytes>
<CanonicalRequest>POST /test.jpg uploads=content-type:application/xml host:mu-actual-bucket-name.s3.ap-south-1.amazonaws.com x-amz-content-sha256:UNSIGNED-PAYLOAD x-amz-date:Wed, 08 Aug 2018 08:23:10 GMT content-type;host;x-amz-content-sha256;x-amz-date UNSIGNED-PAYLOAD</CanonicalRequest>
<CanonicalRequestBytes>50 4f 53 54 0a 2f 74 65 73 74 2e 6a 70 67 0a 75 70 6c 6f 61 64 73 3d 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 6d 6c 0a 68 6f 73 74 3a 65 73 62 66 69 6c 65 75 70 6c 6f 61 64 62 75 63 6b 65 74 2d 61 73 69 61 70 61 63 69 66 69 63 2d 74 65 73 74 2e 73 33 2e 61 70 2d 73 6f 75 74 68 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 57 65 64 2c 20 30 38 20 41 75 67 20 32 30 31 38 20 30 38 3a 32 33 3a 31 30 20 47 4d 54 0a 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes>
<RequestId>80DE16FCBABF50AB</RequestId>
<HostId>RTsE/AyWE01BZTl2VvgBcY4XLq2vXDsMC591ZRBqn5xKRrorrxQM4Jl2/SESXtRPqjS2qP5WQRU=</HostId></Error>
访问/秘钥是100%正确。
下面是我的突触配置:
<?xml version="1.0" encoding="UTF-8"?><api context="/service/awss3/uploadImage" name="API_UploadImage" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/">
<inSequence>
<log description="Full log" level="full"/>
<amazons3.init>
<accessKeyId>AKIA****</accessKeyId>
<secretAccessKey>STRVC*********</secretAccessKey>
<region>ap-south-1</region>
<methodType>POST</methodType>
<contentType>multipart/form-data</contentType>
<addCharset>false</addCharset>
<host>s3.amazonaws.com</host>
<isXAmzDate>true</isXAmzDate>
<bucketName>my-actual-bucket-name</bucketName>
<blocking>false</blocking>
</amazons3.init>
<amazons3.initMultipartUpload>
<bucketUrl>http://my-actual-bucket-name.s3.ap-south-1.amazonaws.com</bucketUrl>
<objectName>test.jpg</objectName>
</amazons3.initMultipartUpload>
<property name="ContentType" scope="axis2" type="STRING" value="application/xml"/>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
我检查了aws签名生成伪语法。一切都很好 由于此错误与多部分无关,因此更改内容类型无济于事。 我想知道有人在这方面可以帮助我
授权标头值,其他值可以在下面的电汇日志中找到 电汇登录esb:
[2018-08-08 12:28:47,531] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> POST /service/awss3/uploadImage HTTP/1.1[\r][\n]"
[2018-08-08 12:28:47,532] []调试-有线HTTP侦听器I / O调度程序2 >>“ Content-Type:application / json [\ r] [\ n]”
[2018-08-08 12:28:47,534] []调试-有线HTTP侦听器I / O调度程序2 >>“缓存控制:无缓存[\ r] [\ n]”
[2018-08-08 12:28:47,534] []调试-有线HTTP侦听器I / O调度程序2 >>“邮递员令牌:0986023d-3b81-4715-9251-240afa195f51 [\ r] [\ n] “
[2018-08-08 12:28:47,537] []调试-有线HTTP侦听器I / O调度程序2 >>“ User-Agent:PostmanRuntime / 7.2.0 [\ r] [\ n]”
[2018-08-08 12:28:47,537] []调试-有线HTTP侦听器I / O调度程序2 >>“接受: / [\ r] [\ n]”
[2018-08-08 12:28:47,539] []调试-有线HTTP侦听器I / O调度程序2 >>“主机:192.168.1.138:8280[\r][\n]”
[2018-08-08 12:28:47,541] []调试-有线HTTP侦听器I / O调度程序2 >>“ accept-encoding:gzip,deflate [\ r] [\ n]”
[2018-08-08 12:28:47,542] []调试-有线HTTP侦听器I / O调度程序2 >>“内容长度:0 [\ r] [\ n]”
[2018-08-08 12:28:47,542] []调试-有线HTTP侦听器I / O调度程序2 >>“连接:keep-alive [\ r] [\ n]”
[2018-08-08 12:28:47,543] []调试-有线HTTP侦听器I / O调度程序2 >>“ [\ r] [\ n]”
[2018-08-08 12:28:47,550] []信息-LogMediator发送至:/ service / awss3 / uploadImage,MessageID:urn:uuid:d00ae717-1536-42de-8509-f537fbb5684b,方向:请求,信封:
[2018-08-08 12:28:49,733] []调试-有线HTTP-Sender I / O调度程序2 <<“ POST /test.jpg?上传HTTP / 1.1 [\ r] [\ n]”
[2018-08-08 12:28:49,734] []调试-有线HTTP发送方I / O调度程序-2 <<“授权:AWS4-HMAC-SHA256凭据= AKIA **** / 20180808 / ap-south- 1 / s3 / aws4_r
equest,SignedHeaders = content-type;主机; x-amz-content-sha256; x-amz-date,Signature = da9d34caa3e266d81e712eeed0091ef42c34b119fd80110bcda14fda8e3ee8ce [\ r] [\ n]“
[2018-08-08 12:28:49,736] []调试-有线HTTP发送方I / O调度程序2 <<“ x-amz-content-sha256:UNSIGNED-PAYLOAD [\ r] [\ n]” < br />
[2018-08-08 12:28:49,737] []调试-有线HTTP发送器I / O调度程序2 <<“接受: / [\ r] [\ n]”
[2018-08-08 12:28:49,738] []调试-Wire HTTP-Sender I / O dispatcher-2 <<“ x-amz-date:Wed,08 Aug 2018 06:58:47 GMT [\ r] [\ n]“
[2018-08-08 12:28:49,739] []调试-有线HTTP发送方I / O调度程序2 <<“邮递员令牌:0986023d-3b81-4715-9251-240afa195f51 [\ r] [\ n] “
[2018-08-08 12:28:49,740] []调试-有线HTTP发送方I / O调度程序2 <<“缓存控制:无缓存[\ r] [\ n]”
[2018-08-08 12:28:49,741] []调试-Wire HTTP-Sender I / O dispatcher-2 <<“ accept-encoding:gzip,deflate [\ r] [\ n]”
[2018-08-08 12:28:49,743] []调试-有线HTTP-Sender I / O调度程序-2 <<“内容类型:application / xml [\ r] [\ n]”
[2018-08-08 12:28:49,745] []调试-有线HTTP发送方I / O调度程序2 <<“传输编码:分块[\ r] [\ n]”
[2018-08-08 12:28:49,746] []调试-有线HTTP发送方I / O调度程序2 <<“主机:my-actual-bucket-name.s3.ap-south-1.amazonaws.com [\ r] [\ n]“
[2018-08-08 12:28:49,747] []调试-有线HTTP发送方I / O调度程序2 <<“连接:保持活动[\ r] [\ n]”
[2018-08-08 12:28:49,748] []调试-有线HTTP-Sender I / O调度程序-2 <<“用户代理:Synapse-PT-HttpComponents-NIO [\ r] [\ n]” < br />
[2018-08-08 12:28:49,749] []调试-有线HTTP-Sender I / O调度程序2 <<“ [[r] [\ n]”
[2018-08-08 12:28:49,750] []调试-有线HTTP发送方I / O调度程序2 <<“ 0 [\ r] [\ n]”
[2018-08-08 12:28:49,751] []调试-有线HTTP-Sender I / O调度程序2 <<“ [\ r] [\ n]”
[2018-08-08 12:28:49,957] []调试-有线HTTP-Sender I / O调度程序-2 >>“ HTTP / 1.1 403 Forbidden [\ r] [\ n]”
[2018-08-08 12:28:49,959] []调试-有线HTTP发送方I / O调度程序2 >>“ x-amz-request-id:475296DD643A3101 [\ r] [\ n]”
[2018-08-08 12:28:49,961] []调试-有线HTTP发送方I / O调度程序2 >>“ x-amz-id-2:Gs4CxzFfmj7bnjqIh2kG7HSsRo4vPnNhJ6IzCXmbCqRfUIq6NuHlOZ0SXa6Msi +
\ n]“
[2018-08-08 12:28:49,964] []调试-有线HTTP发送方I / O调度程序2 >>“内容类型:application / xml [\ r] [\ n]”
[2018-08-08 12:28:49,965] []调试-有线HTTP发送方I / O调度程序2 >>“ Transfer-Encoding:chunked [\ r] [\ n]”
[2018-08-08 12:28:49,966] []调试-有线HTTP发送方I / O调度程序2 >>“日期:2018年8月8日星期三06:58:52 GMT [\ r] [\ n] “
[2018-08-08 12:28:49,967] []调试-有线HTTP-Sender I / O调度程序2 >>“ Connection:close [\ r] [\ n]”
[2018-08-08 12:28:49,969] []调试-有线HTTP-Sender I / O调度程序2 >>“服务器:AmazonS3 [\ r] [\ n]”
[2018-08-08 12:28:49,970] []调试-有线HTTP发送方I / O调度程序2 >>“ [\ r] [\ n]”
[2018-08-08 12:28:50,007] []调试-有线HTTP发送方I / O调度程序2 >>“ 912 [\ r] [\ n]”
[2018-08-08 12:28:50,008] []调试-有线HTTP发送方I / O调度程序2 >>“ [\ n]”
[2018-08-08 12:28:50,009] []调试-有线HTTP-Sender I / O调度程序2 >>“ SignatureDoesNotMatch
我们计算出的请求签名没有
与您提供的签名匹配。检查密钥和签名方法。AKIA**** AWS4-HMAC-SHA256 [\ n]“
[2018-08-08 12:28:50,011] []调试-有线HTTP发送方I / O调度程序2 >>“星期三,2018年8月8日06:58:47 GMT [\ n]”
[2018-08-08 12:28:50,012] []调试-有线HTTP发送方I / O调度程序2 >>“ 20180808 / ap-south-1 / s3 / aws4_request [\ n]”
[2018-08-08 12:28:50,012] []调试-有线HTTP发送方I / O调度程序2 >>“ 0cc7cebc621dffec5262c7221b1441a8d3f957c846c8b0d16db3c41121ffdf2ada9d34caa3e266d81e712eeed0091ef42c34bdaf43a 43e 43e 43e 43e 43e 43e 43e 43e 43e 43e 43e 43e 43e 43e43e 43e43e 41e43e 43e43e 43e43e 43e43e 43e43e 41e43e 43e43e 43e43e 43e43e 41e43e 43e43e 43e43e 41e43e 43e
2c 20 30 38 20 41 75 67 20 32 30 31 38 20 30 36 3a 35 38 3a 34 37 20 47 4d 54 0a 32 30 31 38 30 38 30 38 2f 61 70 2d 73 6f 75 74 68 2d 31 2f 73 33 2f 61 77 73 34 5f 72
65 71 75 65 73 74 0a 30 63 63 37 63 65 62 63 36 32 31 64 66 66 65 63 35 32 36 32 63 37 32 32 31 62 31 34 34 31 61 38 64 33 66 39 35 37 63 38 34 36 63 38 62 30 64 31 36
64 62 33 63 34 31 31 32 31 66 66 64 66 32 61POST [\ n]“
[2018-08-08 12:28:50,014] []调试-有线HTTP-Sender I / O调度程序2 >>“ /test.jpg[\n]”
[2018-08-08 12:28:50,015] []调试-有线HTTP-Sender I / O调度程序2 >>“ uploads = [\ n]”
[2018-08-08 12:28:50,015] []调试-有线HTTP-Sender I / O调度程序2 >>“ content-type:application / xml [\ n]”
[2018-08-08 12:28:50,016] []调试-有线HTTP发送方I / O调度程序2 >>“ host:my-actual-bucket-name.s3.ap-south-1.amazonaws.com [\ n]“
[2018-08-08 12:28:50,016] []调试-有线HTTP发送方I / O调度程序2 >>“ x-amz-content-sha256:UNSIGNED-PAYLOAD [\ n]”
[2018-08-08 12:28:50,016] []调试-有线HTTP发送方I / O调度程序2 >>“ x-amz-date:Wed,08 Aug 2018 06:58:47 GMT [\ n] “
[2018-08-08 12:28:50,017] []调试-有线HTTP-Sender I / O调度程序2 >>“ [\ n]”
[2018-08-08 12:28:50,017] []调试-有线HTTP发送方I / O调度程序2 >>“ content-type; host; x-amz-content-sha256; x-amz-date [\ n]“
[2018-08-08 12:28:50,018] []调试-有线HTTP发送方I / O调度程序2 >>“ UNSIGNED-PAYLOAD50 4f 53 54 0a 2f 74 65 73 74 2e 6a
70 67 0a 75 70 6c 6f 61 64 73 3d 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 6d 6c 0a 68 6f 73 74 3a 65 73 62 66 69 6c 65 75 70 6c
6f 61 64 62 75 63 6b 65 74 2d 61 73 69 61 70 61 63 69 66 69 63 2d 74 65 73 74 2e 73 33 2e 61 70 2d 73 6f 75 74 68 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78
2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 57 65 64 2c 20 30 38 20
41 75 67 20 32 30 31 38 20 30 36 3a 35 38 3a 34 37 20 47 4d 54 0a 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73
68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44475296DD643A3101Gs4CxzFfmj7bnjqIh2kG7HSsRo4vPnNhJ6IzCXmbCqRfUIq6N [J]
[2018-08-08 12:28:50,021] []调试-有线HTTP发送方I / O调度程序2 >>“ 0 [\ r] [\ n]”
[2018-08-08 12:28:50,021] []调试-有线HTTP发送方I / O调度程序2 >>“ [\ r] [\ n]”
[2018-08-08 12:31:47,574] []信息-调用notifyWriterError
时SourceHandler Writer为null
[2018-08-08 12:31:47,577] []警告-读取请求后SourceHandler连接超时:http-incoming-6套接字超时:180000远程地址:/192.168.1.138:35
38