Hi,

I can succesfull create a spreadsheet using the java api

--- start doclist code ---

DocsService docsService =new DocsService(applicationName);
docsService.setProtocolVersion(DocsService.Versions.V3);
docsService.setUserCredentials("AAA", "BBB");
com.google.gdata.data.docs.SpreadsheetEntry newEntry  = new
com.google.gdata.data.docs.SpreadsheetEntry();
String spreadSheetTitle="test";
newEntry.setTitle(new PlainTextConstruct(spreadSheetTitle));
com.google.gdata.data.docs.SpreadsheetEntry spreadSheet =
docsService.insert(new URL("https://docs.google.com/feeds/default/
private/full/"), newEntry);

--- end doclist code ---
Next step would be to work with this spreadsheet using the spreadsheet
API

This code (I am trying to get a cellFeedUrl in two different ways):
---- start spreadsheet code -----------

SpreadsheetService ssSvc = new SpreadsheetService(applicationName);
ssSvc.setUserCredentials("AAA", "BBB");
ssSvc.setProtocolVersion(SpreadsheetService.Versions.V3);

FeedURLFactory urlFactory = FeedURLFactory.getDefault();

URL cellFeedUrl =
urlFactory.getCellFeedUrl(spreadSheet.getResourceId(), "od6",
"private", "full"); //this is the spreadSheet object from above

System.out.println(cellFeedUrl);
cellFeedUrl = spreadSheet.getDefaultWorksheet().getCellFeedUrl(); //
this is the spreadSheet object from above
System.out.println(cellFeedUrl.toExternalForm());
CellFeed cellFeed = ssSvc.getFeed(cellFeedUrl, CellFeed.class);

------------ end code ---------
executing this code results in the log below.
The first cellFeedUrl is wrong %3A doesnot make sense there, and even
if it did, this URL doesn't in fact Locate a Unique Resource (I get an
InvalidEntryException when I start working with this one)
The second cellFeedUrl cannot be build, since aperently I the
authentication is lost, but I just created the spreadsheet ?
----------- start log ----------
https://spreadsheets.google.com/feeds/cells/spreadsheet%3A0AlwWDkVdlmBedDBBUXZlWVRIb3diU2NLNnBtZlYxZFE/od6/private/full
17-jan-2012 23:36:29
com.google.appengine.repackaged.org.apache.http.impl.client.DefaultRequestDirector
handleResponse
WARNING: Authentication error: Unable to respond to any of these
challenges: {googlelogin=WWW-Authenticate: GoogleLogin realm="https://
www.google.com/accounts//ClientLogin", service="wise"}
com.google.gdata.util.AuthenticationException: OK
<HTML>
<HEAD>
<TITLE>Token invalid</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Token invalid</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

        at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:
600)
        at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:
563)
        at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:
552)
        at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:
530)
        at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
535)
        at com.google.gdata.client.Service.getEntry(Service.java:1352)
        at com.google.gdata.client.GoogleService.getEntry(GoogleService.java:
567)
        at com.google.gdata.client.Service.getEntry(Service.java:1278)
        at
com.google.gdata.data.docs.SpreadsheetEntry.getDefaultWorksheet(SpreadsheetEntry.java:
123)

--- end log ---

Reply via email to