我通过以下方式向documentDB发送查询:
client = new DocumentClient(END_POINT,
MASTER_KEY, ConnectionPolicy.GetDefault(),
ConsistencyLevel.Session);
FeedResponse<Document> documents = client.queryDocuments("/dbs/mydb/colls/mycoll", query, null);
然后当我尝试从服务器读取响应时
for (Document document : documents.getQueryIterable())
我遇到了以下异常:
{"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
请帮帮我,我不知道如何解决此错误
答案 0 :(得分:0)
解决方案是从Android Base64实现切换到apache。