我正在尝试使用Amazon S3 API制作AutoIT脚本界面。我一直在尝试SOAP和REST,尽管没有成功。AutoIT脚本/ UDF与Amazon S3 API接口
这是SOAP代码我与(从Ptrex在AutoIt的论坛变形例)的工作,但我得到如下回应: “soapenv:Client.badRequest缺少SOAPAction头”
说实话,代码对我来说并没有多大意义,我真的只是在修补。
任何例子或指针,让我正确的方向在如何正确地与亚马逊S3 API接口将不胜感激!
; Initialize COM error handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
$objHTTP = ObjCreate("Microsoft.XMLHTTP")
$objReturn = ObjCreate("Msxml2.DOMDocument.3.0")
$strEnvelope = '<soap:envelope xmlns:soap="urn:schemas-xmlsoap-org:soap.v1">' & _
'<soap:header></soap:header>' & _
'<soap:body>' & _
'<ListAllMyBuckets xmlns="http://doc.s3.amazonaws.com/2006-03-01">' & _
'<AWSAccessKeyId>MYACCESSKEYID</AWSAccessKeyId>' & _
'<Timestamp>2006-03-01T12:00:00.183Z</Timestamp>' & _
'<Signature>MYSECRETSIGNATURE</Signature>' & _
'</ListAllMyBuckets>' & _
'</soap:body>' & _
'</soap:envelope>'
; Set up to post to our local server
$objHTTP.open ("post", "https://s3.amazonaws.com/soap", False)
; Set a standard SOAP/ XML header for the content-type
$objHTTP.setRequestHeader ("xmlns:aws", "http://security.amazonaws.com/doc/2007-01-01/")
Make the SOAP call
$objHTTP.send ($strEnvelope)
; Get the return envelope
$strReturn = $objHTTP.responseText
; ConsoleWrite("Debug : "& $strReturn & @CR & @CR)
; Load the return envelope into a DOM
$objReturn.loadXML ($strReturn)
ConsoleWrite("Return of the SOAP Msg : " & @CR & $objReturn.XML & @CR & @CR)
; Query the return envelope
$strQuery = "SOAP:Envelope/SOAP:Body/ListAllMyBuckets"
$dblTax = $objReturn.selectSingleNode($strQuery)
$Soap = $objReturn.Text
MsgBox(0,"SOAP Response",$Soap)