none
Storage analytics properties using Java SDK

    Question

  • Hi,

    I’m using Azure SDK for Java, to retrieve the analytics properties of storage services.
    Besides creating the right client for each service, the code to get the properties is identical:

    CloudStorageAccount storageAccount = CloudStorageAccount.parse(connectionString);
    ServiceClient serviceClient = storageAccount.createCloudTableClient();
    // ServiceClient serviceClient = storageAccount.createCloudBlobClient();
    // ServiceClient serviceClient = storageAccount. createCloudQueueClient();
    ServiceProperties serviceProperties = serviceClient.downloadServiceProperties();


    This works fine for Blob and Queue services under the storage, but throws the following exception when calling it for the Table service:
    com.microsoft.windowsazure.services.core.storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

    After inspecting the code a bit, I’ve noticed that inside the downloadServiceProperties() API, there is a signing process of the request which uses the BaseRequest.signRequestForBlobAndQueue method.
    Therefore, the sign process for Queue and Blob services is also used for Table service.

    Can anyone please advise if there is a bug here of should I do something differently?

    Thanks,
    Yoav



    http://communities.quest.com/community/cloud_tools?view=blog

    Monday, February 04, 2013 5:26 PM

Answers

All replies

  • Hi,

    I find many cases for this error is the wrong system datetime, which causes the wrong Authorization header. You can use fiddler to check if it is correct or not:

    http://amiatypist.blogspot.com/2011/06/microsoft-azure-server-failed-to.html

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 05, 2013 5:59 AM
    Moderator
  • Hi,

    I don’t think that the reason to the authentication failure is wrong system datetime, as described in the attached blog.
    I did verified it using fiddler, where I don’t see any detailed error in the response header.

    As I’ve describe above, I make calls to download the analytics properties of all storage services, all done in the same way.
    The calls to the Queue and Blob services work fine, but only the call to the Table service fails.
    The implementation in the azure API jar uses the signing process of Blobs and Queues for all 3 services, including the Table service.
    This process is implemented in the BaseRequest.signRequestForBlobAndQueue method.
    As explained here - http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx - the authentication for Table service is different.
    There is another method in the jar called BaseRequest.signRequestForTableSharedKeyLite which should probably be used for Table service.

    Since all methods and classes in the jar are declared as ‘final’, I cannot override anything.
    Is there any solution that I can use here besides implementing the whole process again just for this issue (which obviously is not a good solution) ?

    Thanks,
    Yoav



    http://communities.quest.com/community/cloud_tools?view=blog

    Tuesday, February 05, 2013 3:07 PM
  • Hi,

    I find a similar issue thread, you can refer some ways to handle it:

    http://social.msdn.microsoft.com/Forums/hu/windowsazuredata/thread/31ee12a9-801c-4eca-bfe1-1f0fced33426

    If it doesn't help, you can send a request or issue to the azure sdk for java team:

    https://github.com/WindowsAzure/azure-sdk-for-java

    If still no help, feel free to come back. I will involve someone familiar this part to help you.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 06, 2013 2:49 AM
    Moderator