Ebeo / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Receiving "The remote server returned an error: (401) Unauthorized" - ResponseString "Protocol error" #398

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
- Attempt to retrieve document using the DocumentService.Query

What is the expected output? What do you see instead?
- Expected output is a valid Stream from which I can retrieve Bytes
- Exception (as in the Summary)

Please use labels and text to provide additional information.

---snip--- Pseudo code
String documentUrl = "https://docs.google.com/
feeds/default/private/full";

                   GOAuthRequestFactory documentRequestFactory = new
GOAuthRequestFactory("writely", "mycompany.com.au");
                   documentRequestFactory.ConsumerKey = "mykey";
                   documentRequestFactory.ConsumerSecret =
"mysecret";
                   documentRequestFactory.ProtocolMajor = 3;

                   DocumentsService documentService = new
DocumentsService("MyApp");
                   documentService.RequestFactory =
documentRequestFactory;

                   // document is a valid DocumentEntry
                   if (document.ResourceId.Contains("file") ||
document.ResourceId.Contains("pdf"))
                   {
                       downloadUrl = document.Content.Src.Content;
                   }
                   else if (document.ResourceId.Contains("document"))
                   {
                       downloadUrl = "https://docs.google.com/feeds/
download/documents/Export?docID=" + document.ResourceId +
"&exportFormat=doc";
                   }
                   //other types
                   Stream inStream = this.documentService.Query(new
Uri(downloadUrl));
---snip--- Pseudo code

Original issue reported on code.google.com by adam.bra...@gmail.com on 29 Jun 2010 at 3:06

GoogleCodeExporter commented 9 years ago
working on this with internal team. 

Original comment by fman...@gmail.com on 29 Jun 2010 at 2:51

GoogleCodeExporter commented 9 years ago
I've also tried enabling SSL on the documentRequestFactory and removing the 
ProtocolMajor setting 

this.documentRequestFactory.UseSSL = true;

Sincerely,
Adam

Original comment by adam.bra...@gmail.com on 29 Jun 2010 at 10:37

GoogleCodeExporter commented 9 years ago
I've been able to pull Files, Documents and Presentations using a 
DocumentQuery, seems as though the constructor for DocumentService.Query 
doesn't have provision for the ID of the requestor. So the following block 
works, however, downloading spreadsheets fails, I'll log another bug for that 
now.

---snip---                   
//Use DocumentQuery!
DocumentQuery dq = new DocumentQuery(downloadUrl);
dq.UseSSL = true;
dq.OAuthRequestorId = this.requestor;                   
Stream inStream = documentService.Query(dq.Uri);
---snip---

Getting closer!

Original comment by adam.bra...@gmail.com on 1 Jul 2010 at 1:11

GoogleCodeExporter commented 9 years ago
Adam,

If you confirm that DocumentQuery works we can mark this issue as fixed.
Thanks

Claudio

Original comment by ccherub...@google.com on 7 Dec 2010 at 8:43

GoogleCodeExporter commented 9 years ago

Original comment by ccherub...@google.com on 14 Dec 2010 at 4:47