You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HELP ME, I got problem when trying to create New Spreadsheet using
Spreadsheet API.
1. The first, I make a function to create a new Spreadsheed and insert to
Google DocsService:
public DocumentListEntry createNewDocument(String title)
throws IOException, ServiceException {
DocumentListEntry newEntry = null;
newEntry = new SpreadsheetEntry();
newEntry.setTitle(new PlainTextConstruct(title));
return docsService.insert(new URL(
"http://docs.google.com/feeds/documents/private/full"),
newEntry);
}
2. I use Java code below to call function above, to create a new Speadsheet
which I name it "test-thuycq84":
// declare a new entry for spreadsheet
DocumentListEntry createdEntry = null;
// Create an empty spreadsheet
try {
createdEntry = createNewDocument("test-thuycq84");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Spreadsheet now online @ :"+
createdEntry.getHtmlLink().getHref());
3. When i run program on Windows XP, expected output that:
"Spreadsheet now online @:<http://...>"
But it returns output with an error as below:
com.google.gdata.util.AuthenticationException: Authorization required
<HTML>
<HEAD>
<TITLE>Authorization required</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Authorization required</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataReque
st.java:508)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataR
equest.java:555)
at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.jav
a:480)
at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:459)
at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
527)
at com.google.gdata.client.Service.insert(Service.java:1243)
at com.google.gdata.client.GoogleService.insert(GoogleService.java:560)
at com.google.gdata.client.media.MediaService.insert(MediaService.java:323)
at uploadrms.testNewSS.createNewDocument(testNewSS.java:111)
at uploadrms.testNewSS.init(testNewSS.java:92)
at uploadrms.testNewSS.main(testNewSS.java:61)
############
What must I do to fix this problem? I need help...!!
Original issue reported on code.google.com by thuyc...@gmail.com on 5 Jan 2010 at 3:30
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
thuyc...@gmail.com
on 5 Jan 2010 at 3:30The text was updated successfully, but these errors were encountered: