[note - this isn't an answer, but it may help you get closer]
A few issues:
0) You are calling the <script src="../jsapi.js">, but not actually
using it for talking to the server. That's a bit confusing to me. It
renders a bunch of your code moot.
1) If you are writing the XML yourself, you need the correct prefix =
'<?xml version="1.0" encoding="UTF-8"?>';
2) GData is picky about the root being "<atom:entry>", and NOT
"<entry>"
3) Your onClose: function() {fetchData(url,pCallBack,pData,pMethod);}
is missing the last arg. I suspect that it should be "onClose: function
() {fetchData(url,pCallBack,pData,pMethod, pHeaders);}"
4) I don't think these are needed [though I'm not sure if they
actually hurt]
params[gadgets.io.RequestParameters.NUM_ENTRIES] = 100;
params[gadgets.io.RequestParameters.GET_SUMMARIES] = true;
5) If you don't use the jsapi libs, then you may want to double check
the line here for redirects "else if (response.data) {"
On Aug 14, 3:00 am, Phyrefly <[email protected]> wrote:
> I am writing an iGoogle gadget, which calls the calendar API to add
> and read events from its own calendar within a user's collection. So
> far, I've managed to get OAuth working, and retrieved a list of
> calendars, now I'm trying to create the requested calendar name if it
> doesn't exist.
>
> I create an xml string, and send it to the url as documented in the
> Calendar API, but no luck...
> I get a 400 header and "com.sun.syndication.io.ParsingFeedException:
> Invalid XML"
> every time. I don't get any more detail than that. Can anyone help
> me with this?
>
> Code snippets follow:
>
> var newCal = '';
> newCal = newCal + '<entry xmlns=\'http://www.w3.org/2005/Atom\'';
> newCal = newCal + ' xmlns:gd=\'http://schemas.google.com/g/2005\'';
> newCal = newCal + ' xmlns:gCal=\'http://schemas.google.com/gCal/2005\'>';
> newCal = newCal + ' <title type=\'text\'>P-Budget</title>';
> newCal = newCal + ' <summary type=\'text\'>This calendar was created
> for the Cal-Budget iGoogle gadget.</summary>';
> newCal = newCal + ' <gCal:timezone value=\'Europe/London\'></gCal:timezone>';
> newCal = newCal + ' <gCal:hidden value=\'false\'></gCal:hidden>';
> newCal = newCal + ' <gCal:color value=\'#2952A3\'></gCal:color>';
> newCal = newCal + '</entry>';
>
> var url = 'http://www.google.com/calendar/feeds/default/owncalendars/full';
> var headers = {
> "Content-Type": "application/atom+xml"
>
> };
>
> fetchData(url,newCalResponse,newCal,"POST",headers);
>
> then in fetchData, the following code:
>
> var params = {};
> params[gadgets.io.RequestParameters.CONTENT_TYPE]
> =gadgets.io.ContentType.FEED;
> params[gadgets.io.RequestParameters.AUTHORIZATION]
> =gadgets.io.AuthorizationType.OAUTH;
> params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] = "google";
> params[gadgets.io.RequestParameters.OAUTH_USE_TOKEN] = "always";
> params[gadgets.io.RequestParameters.METHOD] =
> eval("gadgets.io.MethodType."+pMethod);
> params[gadgets.io.RequestParameters.NUM_ENTRIES] = 100;
> params[gadgets.io.RequestParameters.GET_SUMMARIES] = true;
> if (pData) {params[gadgets.io.RequestParameters.POST_DATA] = pData;}
> if (pHeaders) {params[gadgets.io.RequestParameters.HEADERS] =pHeaders;}
>
> gadgets.io.makeRequest(url, function (response) {}, params);
>
> (I've snipped the content of the response function for ease of
> reading)
>
> Others have tried posting this xml to that URL, and say it works, so
> the error must be in the set of params I am posting to the makeRequest
> function (or some other obscure conflict of settings somewhere). Has
> anyone tried using this method from within a gadget? Can anyone see
> anything obviously wrong with what I'm trying?
>
> The full gadget code is available
> here.http://hosting.gmodules.com/ig/gadgets/file/117332718031107708419/P-B...
>
> Please help!
>
> Thanks,
> Rich
> Sent from London, Eng, United Kingdom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---