I try to use the following code to rename my object.
EsuRestApi api = new EsuRestApi(HOST, 443, TOKENID, SECRETKEY);
api.rename(new ObjectPath(old_filename),
new ObjectPath(new_filename), false);
However i got some problems when i was testing.
Am I using wrong method to rename object?
01-14 11:31:47.655: E/AndroidRuntime(29647): FATAL EXCEPTION: main
01-14 11:31:47.655: E/AndroidRuntime(29647): com.emc.esu.api.EsuException: There was a mismatch between the signature in the request and the signature computed by the server.
01-14 11:31:47.655: E/AndroidRuntime(29647): at com.emc.esu.api.rest.EsuRestApi.handleError(EsuRestApi.java:2325)
01-14 11:31:47.655: E/AndroidRuntime(29647): at com.emc.esu.api.rest.EsuRestApi.rename(EsuRestApi.java:2033)
01-14 11:31:47.655: E/AndroidRuntime(29647): at com.cx.ecs.MainActivity$6.onClick(MainActivity.java:429)
01-14 11:31:47.655: E/AndroidRuntime(29647): at android.view.View.performClick(View.java:4084)
01-14 11:31:47.655: E/AndroidRuntime(29647): at android.view.View$PerformClick.run(View.java:16966)
01-14 11:31:47.655: E/AndroidRuntime(29647): at android.os.Handler.handleCallback(Handler.java:615)
01-14 11:31:47.655: E/AndroidRuntime(29647): at android.os.Handler.dispatchMessage(Handler.java:92)
01-14 11:31:47.655: E/AndroidRuntime(29647): at android.os.Looper.loop(Looper.java:137)
01-14 11:31:47.655: E/AndroidRuntime(29647): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-14 11:31:47.655: E/AndroidRuntime(29647): at java.lang.reflect.Method.invokeNative(Native Method)
01-14 11:31:47.655: E/AndroidRuntime(29647): at java.lang.reflect.Method.invoke(Method.java:511)
01-14 11:31:47.655: E/AndroidRuntime(29647): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-14 11:31:47.655: E/AndroidRuntime(29647): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-14 11:31:47.655: E/AndroidRuntime(29647): at dalvik.system.NativeStart.main(Native Method)
Since the destination file path is sent as an HTTP header, it's important that the EsuRestApi object is in Unicode mode. This is supported by Atmos 1.4.2+ and 2.0.1+. You can enable it with:
Are you still getting the same error message (mismatch between the signature)? That means either the secret key is bad or something's wrong with the headers. Since you're using our SDK, I'm inclined to believe it's the prior. Are you absolutely SURE your secret key is correct? Is it something you're typing in on the emulator or a string in the code?
The code you show here does not have any non-latin characters, so unless I'm missing something, I don't think that's the problem. However, when enabling UTF-8 encoding, be sure to do that right away, (i.e. before calling createObject).
If you're using the correct token ID and secret key and still getting this message, I would start debugging by hard-coding the tokenID and secret key inside your app first and use ASCII characters in the file names. If that still doesn't work, perhaps there is a problem in the encryption library when used with Android. Note that we have not tested the SDK on that platform (it's unfortunate we would even have to since it's Java).
If it does work, then the problem is in the handling of the credentials.
Are you behind a firewall or proxy? We've seen some instances where corporate firewalls either modify certain HTTP headers and/or add/remove headers that somehow affects the signature of the request (e.g. change "Content-Type"). Are you running your own internal Atmos or are you using a service provider like AT&T?
JasonCwik
1 Rookie
•
281 Posts
1184
0
Posted January 14th, 2013 08:00
What is the destination filename?
Since the destination file path is sent as an HTTP header, it's important that the EsuRestApi object is in Unicode mode. This is supported by Atmos 1.4.2+ and 2.0.1+. You can enable it with:
api.setUnicodeEnabled(true);