1

我正在尝试发送指令以使用 VFP9 创建一个新的 SimpleDB 域。

.fll 库得益于红薯软件,并且使用附加变量解决了小时差异。我在这里看到了其他带有 java 和 php 的示例。另外,我一直在查看 aws 开发人员页面以获取有关此示例的示例:

http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/index.html?REST_RESTAuth.html http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/SDB_API_CreateDomain.html

但仍然没有运气。我制作了一个 .prg 文件来测试我的连接,并收到:

<?xml version="1.0"?>
<Response><Errors><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message></Error></Errors><RequestID>2e4718de-4ba2-2f76-0aad-a7f3a4c86ab5</RequestID></Response>

这是我的 .prg 的代码:

*   http://www.sweetpotatosoftware.com/SPSBlog/2009/08/09/MajorVFPEncryptionUpdate.aspx

SET LIBRARY TO ('vfpencryption71.fll')

PUBLIC cURL_AWS_SDBService

PUBLIC cAWSAccessKeyId
PUBLIC cAWSSecretAccessKey
PUBLIC cAWS_Action
PUBLIC cAWS_SignatureMethod
PUBLIC cAWS_SignatureVersion
PUBLIC cAWS_Version
PUBLIC cAWS_TimeStamp
PUBLIC cAWS_Signature
PUBLIC nAWS_UTCDifference

nAWS_UTCDifference = 5

cURL_AWS_SDBService = 'https://sdb.amazonaws.com'
cAWS_Action = 'CreateDomain'
cAWSAccessKeyId = (MY_ACCESS_ID)
cAWSSecretAccessKey = (MY_SECRET_ACCESS_KEY)
cAWS_TimeStamp = STRTRAN(STRCONV(TTOC(DATETIME() + (60 * 60 * nAWS_UTCDifference),3),9),':','%3A') + '-00%3A00'
cAWS_SignatureVersion = '2'
cAWS_SignatureMethod = 'HmacSHA256'
cAWS_Version = '2009-04-15'

LOCAL cFirma
SET TEXTMERGE on
TEXT TO cFirma noshow
GET\n<<cURL_AWS_SDBService>>\n/\nAWSAccessKeyId=<<cAWSAccessKeyId>>&Action=<<cAWS_Action>>&DomainName=Atoq_SDB&SignatureMethod=<<cAWS_SignatureMethod>>&SignatureVersion=<<cAWS_SignatureVersion>>&Timestamp=<<cAWS_TimeStamp>>&Version=<<cAWS_Version>>
ENDTEXT
SET TEXTMERGE off
clear
?cFirma

cAWS_Signature = HMAC(cFirma,cAWSSecretAccessKey ,2)
cAWS_Signature = STRCONV(cAWS_Signature,15)
?
?cAWS_Signature
?
SET TEXTMERGE on
TEXT TO cCadena noshow
<<cURL_AWS_SDBService>>/?Action=<<cAWS_Action>>&AWSAccessKeyId=<<cAWSAccessKeyId>>&DomainName=New_Database&SignatureVersion=<<cAWS_SignatureVersion>>&SignatureMethod=<<cAWS_SignatureMethod>>&Timestamp=<<cAWS_TimeStamp>>&Version=<<cAWS_Version>>&Signature=<<cAWS_Signature>>
ENDTEXT

SET TEXTMERGE off
?cCadena
?
objSrvHTTP = CreateObject ("Msxml2.ServerXMLHTTP.3.0")
objSrvHTTP.open('GET',cCadena, .F.)
objSrvHTTP.send()

?objSrvHTTP.responseText

我在这里做错了什么?

TIA

4

1 回答 1

0

愚蠢的问题,但是,您是否故意使用 STRCONV(cAWS_Signature,15) 而不是 STRCONV(cAWS_Signature,13) ?亚马逊文档引用了 Base64Encode(Signature),这就是 VFP9 的 strconv() 帮助文件中 13 的含义

于 2011-04-11T21:52:36.777 回答