Folks,
after having banged my head against the wall for a few hours, I
finally managed to post an entry to Google Calendar using the Google
Data API and Abdera (svn trunk). Here's what I discovered and some
suggestions:
1. Google Data has this pesky authentication mechanism that requires
you to post a request to a given URL including your credentials as
parameters and you get back a token in a text reply that you have to
parse. Of course, this is not Atom, so Abdera is not of much help here.
2. Google expects a Content-Length header when posting an entry. I
found no better way (admittedly I didn't spend much time on this)
than to write my entry to a byte array and count its size. Hardly
optimal, and I wonder whether there's a better way.
3. Google doesn't seem to like postings in chuked encoding format.
Took a while to figure this one out, since the only reply I got was
"400 Bad Request". Abdera, on the other hand, insists on chunking the
output (BaseRequestEntity has a constructor that allows you to
specifiy whether you want it chunked or not, but Client always
invokes the constructor that leaves the parameter to its default,
"true" value.
Regarding point #3 above, I think it would be nice to let the user
decide whether he wants chunked or not, even though this should maybe
be negotiated at the HTTP level, so it might be a problem in
HttpClient or Google, I don't know.
As soon as I've finished cleaning up my code, I will post it
somewhere, but before then, if you have any suggestions re some of
the points above, I might use them.
TIA,
Ugo
--
Ugo Cei
Blog: http://agylen.com/
Open Source Zone: http://oszone.org/
Evil or Not?: http://evilornot.info/
Company: http://www.sourcesense.com/