Azure DocumentDB Java Android 401未经授权

Azure DocumentDB Java Android 401未经授权,java,android,azure,azure-cosmosdb,Java,Android,Azure,Azure Cosmosdb,我正在通过以下方式向documentDB发送查询: client = new DocumentClient(END_POINT, MASTER_KEY, ConnectionPolicy.GetDefault(), ConsistencyLevel.Session); FeedResponse<Document> documents = client.queryDocuments("/dbs/mydb/colls/myco

我正在通过以下方式向documentDB发送查询:

    client = new DocumentClient(END_POINT,
            MASTER_KEY, ConnectionPolicy.GetDefault(),
            ConsistencyLevel.Session);

  FeedResponse<Document> documents = client.queryDocuments("/dbs/mydb/colls/mycoll", query, null);
我遇到了以下异常:

{"code":"Unauthorized","message":"The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol, and check the key being used. Server used the following payload to sign: 'post\ndocs\ndbs/mydb/colls/mycoll\nsun, 12 mar 2017 08:40:40 gmt\n\n'\r\nActivityId: f40f31cf-f11c-4052-94b4-992cfdd271f5"}
请求标头:

"x-ms-date" -> "Sun, 12 Mar 2017 08:40:40 GMT"
"x-ms-documentdb-isquery" -> "true"
"Accept" -> "application/json"
"Content-Type" -> "application/query+json"
"authorization" -> "type%3Dmaster%26ver%3D1.0%26sig%3DiQvTEAbWWK8pvHvr9RAqp2kjiechyPp6S5kvxT4g6Kw%3D%0A"
其他重要的请求值:

resourceid = mycoll
Path = /dbs/mydb/colls/mycoll/docs/
resourceType = Document
IsMedia = false

请帮助我,我不知道如何修复此错误。

解决方案正在从android Base64实现切换到apache。

您好,您能描述一下您到底是如何切换到apache实现的吗?因为我面临着同样的问题,但是用Spring framewok。多谢各位@Miskhout以一种非常丑陋的方式—downlaod documentdb源代码然后进入apache base64类源代码,并将其复制粘贴到另一个命名空间下,这样android就不会取代它。您可以试试,但我不确定spring框架是否适用,因为它不应该覆盖documentdb类。无论如何,我放弃了这个解决方案,转而使用提供应用服务的WebAPI服务器作为中间层。在c#下,一切都像魅力一样,没有任何问题。在这里还发布了未经授权的问题,这是我修改这个库的最后一步,以使它在android下工作。
resourceid = mycoll
Path = /dbs/mydb/colls/mycoll/docs/
resourceType = Document
IsMedia = false