我正在尝试向亚马逊 MWS 提交提要。问题是亚马逊说我提交的 Md5 哈希与他们的计算不匹配,所以我的请求被拒绝了。
这是我用来计算哈希的代码:
var
StringStream: TStringStream;
MessageDigest: TIdHashMessageDigest5;
XMLString: string;
begin
MessageDigest := TIdHashMessageDigest5.Create;
StringStream := TStringStream.Create;
try
StringStream.WriteString(XMLString);
HashString := MessageDigest.HashStream(StringStream);
finally
StringStream.Free;
MessageDigest.Free;
end;
end;
这是亚马逊的回应:
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<Error>
<Type>Sender</Type>
<Code>ContentMD5DoesNotMatch</Code>
<Message>the Content-MD5 HTTP header you passed for your feed (H3GnH3X3H3auHZ0mGZ8mD4KvE30mEJauHKD6E3GoDqK) did not match the Content-MD5 we calculated for your feed (fSEMn6SCuSia5YVdz/1NqQ==)</Message>
<Detail />
</Error>
<RequestID>9c3e0b2a-c418-41dc-b733-e55ac01343b1</RequestID>
</ErrorResponse>
计算 base64 编码的 MD5 哈希的正确方法是什么?我的代码有问题吗?
提前谢谢你,问候。
P。