I am developing an application that store some data in a Amazon SimpleDB instance. When doing update of values in this database I get an error from the API:
Array ( [curl] => [Errors] => Array ( [0] => Array ( [Code] => SignatureDoesNotMatch [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. [BoxUsage] => ) ) )
I have found out that this happens if I try to update the database with some non ASCII characters like “ØÆÅ”. I have double checked that there is not something wrong with the timestamps used to generate the signature (like some questions on the topic at Stack Overflow suggests).
Can anyone confirm that SimpleDB does not support these characters? Does anyone got a workaround for this?
I am using a 3rd party library to access the database. It can be found here: http://sourceforge.net/projects/php-sdb/
Edit:
Further investigation of the 3rd party library shows that all parameters are encoded using rawurlencode(). As far as I can see it also follows the requirements from Amazon that can be found in this article: http://aws.amazon.com/articles/1928
So I am at loss on what to try next here.
Edit 2:
I think I might be closing in on the issue here. I got an iPhone application that uses the same PHP API to store the values as well. The application works fine when posting these non ASCII characters. In the application we set the “Content-Type” to be “application/x-www-form-urlencoded”.
I have found some articles describing the same:
http://groups.google.com/group/simple-record/browse_thread/thread/aa3cd430b35e8e1c?pli=1
I’ve tried to specify the content-type in my code, but have not been successful yet. The implementation uses the PHP function curl to do the request.
I have added this code to set the header, but it does not seem to do any difference:
($headers variable declared at the top of the class)
$this->headers[] = 'Content-Type: application/x-www-form-urlencoded;charset=utf-8';
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers);
I circumvented the problem by posting the data to a php script, then using this script to post the values to Amazon. This fixed the content type issues I had when reading the values directly from a cookie.