Question: what version of the .NET libraries are you using? I don't recall
any particular issue in that regard, but it never hurts to know..

The .NET libraries should be handling the redirect automatically, even on a
delete, so that should not be the cause of the problem. You should be able
to figure out what happens on the wire (hopefully) by inspecting the
ResponseText property of the exception, that should have the complete HTTP
body of the return, if there was one.

I doubt this is related to using HTTP_DELETE compared to POST, using factory
overwrite, but to do that, you need to have the following code:

    GDataGAuthRequestFactory authFactory = this.factory as
GDataGAuthRequestFactory;
    authFactory.MethodOverride = true;

What i would venture to guess is that your calendar redirects on the delete,
which i don't think it's common for it to do, we follow the redirect, and
then it times out... But without a packet sniff on your side that is going
to be hard to verify.

There was an issue before 1.0.8, where .NET would not follow redirect
returns on any HTTP verb beside GET, but if you are running anything later,
this should no longer be an issue.

Frank Mantek
Google






On 4/2/07, Elliott Hamai <[EMAIL PROTECTED]> wrote:
>
> Hi Ryan,
>
> So if I'm understanding you correctly, then by adding in "
> service.RequestFactory.MethodOverride = true;" to my code, I basically
> send delete requests using an HTTP POST instead?  And by doing a POST
> instead to perform a delete action, I shouldn't run into this 302 redirect
> error?  I have this feeling that I'm not understanding you correctly.
>
> When I tried to add the line "service.RequestFactory.MethodOverride =
> true;" to my code right before I sent the Delete request, I got a
> compilation error:
> `Google.GData.Client.IGDataRequestFactory' does not contain a definition
> for `MethodOverride'
> I took a look at the CalendarService.RequestFactory methods, and it didn't
> mention anything about a MethodOverride.  Perhaps you mistook the
> RequestFactory class for the GDataGAuthRequestFactory instead of the
> GDataRequestFactory class?
>
> Lastly, the article that you mentioned tells me to keep the gsessionid or
> S cookie for future reference, but I guess I still don't know how to grab
> this when my request fails and I get a 302 redirect error.  My exception
> handling isn't grabbing this information for some reason and is only telling
> me that the request timed out with the following code:
>
> try { firstMatchEntry.Delete();}
> catch(GDataRequestException error)
> {
>         Console.Write("Received an exception:  {0}",error.Message);
> }
>
> Do you have any advice for me on handling this situation so that I can
> store the new redirecting gsessionid?
>
> Thanks again!
> Elliott
>
>
>
> On 4/1/07, Ryan Boyd (Google) <[EMAIL PROTECTED]> wrote:
> >
> > Hi Elliott,
> >
> > That's actually not an error, but could be an indication of what's
> > happening. The Calendar data API does use redirects for the purpose of
> > handling sessions.  Please see the following KB article for more info: 
> > http://code.google.com/support/bin/answer.py?answer=55833&topic=10360
> >
> >
> > The only difference in the URL you were redirected to is the gsessionid
> > URL parameter.  As you were able to delete the event from your calendar
> > using this URL via curl, it doesn't seem as if there is an issue with your
> > calendar account or the like-- something is happening incorrectly between
> > your code and the client lib/mono/something else.
> >
> > Try doing something like the following, as is shown (in a slightly
> > different way) in the unit test cases:
> >                 service.RequestFactory.MethodOverride = true;
> >
> > This enables using  POST with the override header I wrote about earlier.
> >
> >
> > Also, look at the GDataLoggingRequestFactory -- this will provide some
> > more logging information if used in place of the normal factory object.
> >
> > Cheers,
> >
> > Ryan
> >
> > On 4/1/07, ekun < [EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Wow Ryan you sure know your stuff!  I'm not too familiar with packet
> > > sniffing, so that's on my next list of things to become familiar with,
> > >
> > > but I
> > > may not need that yet because your scripts appear to have found the
> > > problem.  Even with this though, I'm still not sure what the remedy
> > > is.
> > > Here's what I get back on the command line:
> > >
> > > ----------------------------------
> > > ./gdata_calendar_delete.sh [EMAIL PROTECTED] ****
> > >
> > > http://www.google.com/calendar/feeds/[EMAIL 
> > > PROTECTED]/private/full/d2m4la05l9f4kkm3h1fniu08uc/63311131585
> > > * About to connect() to www.google.com port 80
> > > *   Trying 72.14.253.99.. . connected
> > > * Connected to www.google.com ( 72.14.253.99) port 80
> > > > POST /calendar/feeds/ehamai@
> > >
> > > gmail.com/private/full/d2m4la05l9f4kkm3h1fniu08uc/63311131585 HTTP/1.1
> > > > User-Agent: curl/7.15.4 (i486-pc-linux-gnu) libcurl/7.15.4
> > > OpenSSL/0.9.8b
> > >
> > > zlib/1.1.4 libidn/0.6.3
> > > > Host: www.google.com
> > > > Accept: */*
> > > > Content-Type: application/atom+xml
> > > > Authorization: GoogleLogin
> > >
> > > auth=***
> > > > X-HTTP-Method-Override: DELETE
> > > > Content-Length: 0
> > >
> > > < HTTP/1.1 302 Moved Temporarily
> > > < Set-Cookie: S=calendar=4ZPpMUDOYVA
> > > < Location:
> > > http://www.google.com/calendar/feeds/[EMAIL 
> > > PROTECTED]/private/full/d2m4la05l9f4kkm3h1fniu08uc/63311131585?gsessionid=4ZPpMUDOYVA
> > >
> > > < Cache-control: private
> > > < Content-Length: 310
> > > < Date: Mon, 02 Apr 2007 02:44:24 GMT
> > > < Content-Type: text/html
> > > < Server: GFE/1.3
> > > <HTML>
> > > <HEAD>
> > > <TITLE>Moved Temporarily</TITLE>
> > > </HEAD>
> > > <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> > > <H1>Moved Temporarily</H1>
> > > The document has moved <A HREF="
> > >
> > > http://www.google.com/calendar/feeds/[EMAIL 
> > > PROTECTED]/private/full/d2m4la05l9f4kkm3h1fniu08uc/63311131585?gsessionid=4ZPpMUDOYVA
> > > ">here</A>.
> > > </BODY>
> > > </HTML>
> > > * Connection #0 to host www.google.com left intact
> > > * Closing connection #0
> > > -------------------------------------------------------
> > >
> > > It looks like I'm getting a "HTTP/1.1 302 Moved Temporarily" error,
> > > although
> > > I'm not really sure why the document was moved, how I'm supposed to
> > > catch a
> > > 302 error, and how I'm supposed to get the new uri through the C#
> > > API's.  I
> > > took the new address and plugged it into your script and the event
> > > finally
> > > disappeared from my Calendar!  Awesome!  I'm so happy that we're
> > > making
> > > progress on this.  Do you have any idea why the document moved and how
> > > I
> > > should deal with this type of situation in my code?  Thanks again!
> > >
> > > - Elliott
> > >
> > > On Apr 1, 6:18 pm, "Ryan Boyd (Google)" <[EMAIL PROTECTED]> wrote:
> > > > Hi Elliott,
> > > >
> > > > Thanks for the additional information.   I haven't yet tried running
> > >
> > > > the sample code under Mono/Linux, but can certainly give that a shot
> > > > and see if it could be related.
> > > >
> > > > The .NET client library is actually developed under Mono/OS X, so I
> > > > doubt using Mono should be an issue.
> > > >
> > > > The DELETE request is somewhat special, as it doesn't often use a
> > > > common HTTP method (as opposed to GET, POST).  Are you able to do a
> > > > packet capture to analyze the requests?  While the authentication is
> > >
> > > > over SSL, you should be able to see the HTTP traffic in plaintext --
> > > I
> > > > generally use Ethereal/Wireshark for this type of thing, but you can
> > > > also use tcpdump.  This may give you more information about what's
> > > > happening.
> > > >
> > > > You can also try grabbing the 'edit url' via the AtomEntry.EditUri
> > > > property and printing it out.  Using this value, you can try
> > > deleting
> > > > the event manually through curl.  Following this post is the content
> > >
> > > > of 2 shell scripts which use curl.  gdata_calendar_delete.sh calls
> > > > gdata_login.sh to retrieve a ClientLogin token.  It then uses this
> > > > token to DELETE the event by doing a POST with a 'X-HTTP-Method-
> > > > Override: DELETE' header (a GData specific header to perform a
> > > DELETE
> > > > via a HTTP POST).  Calling gdata_calendar_delete.sh is done by:
> > > > ./gdata_calendar_delete.sh <username> <password> <edit url of entry
> > > to
> > > > delete>
> > > >
> > > > Happy coding,
> > > > -Ryan
> > > >
> > > > Disclaimer: These scripts are provided for example purposes only--
> > > I'm
> > > > not providing any guarantees as to the quality or security of these
> > > > scripts.  If you are using a shared machine, your password will be
> > > > viewable in the process listing, and may also be recorded into a
> > > shell
> > > > history file.  You can freely modify these as you wish.
> > > >
> > > > gdata_login.sh
> > > > ----
> > > > #!/bin/sh
> > > > export GDATA_AUTH=`curl
> > > 2>/dev/nullhttps://www.google.com/accounts/ClientLogin
> > > > -d Email=$1 -d Passwd=$2 -d accountType=HOSTED_OR_GOOGLE -d
> > > > source=curlExample -d service=cl | grep '^Auth=' | cut -c 6-`
> > > > echo $GDATA_AUTH
> > > >
> > > > gdata_calendar_delete.sh
> > > > ---
> > > > #!/bin/bash
> > > > export AUTH=`./gdata_login.sh $1 $2`
> > > > curl -v -d '' -H "Content-Type: application/atom+xml" -H
> > > > "Authorization: GoogleLogin auth=$AUTH" -H "X-HTTP-Method-Override:
> > > > DELETE" $3
> > > >
> > > > On Apr 1, 4:59 pm, "ekun" < [EMAIL PROTECTED] > wrote:
> > > >
> > > > > Hi Ryan,
> > > >
> > > > > Thanks for the response!  So to answer your questions:
> > > >
> > > > > 1.) It's taking about 2 minutes to return
> > > > > 2.) I'm not doing anything else with my calendar nor am I running
> > > > > multiple threads.
> > > > > 3.) There shouldn't be any proxy servers between me and Google
> > > unless
> > > > > Comcast has some kind of funky configuration.
> > > >
> > > > > I did try to catch the exception this time and this is the actual
> > > > > message that was output:
> > > >
> > > > > "Execution of request 
> > > > > failed:http://www.google.com/calendar/feeds/[EMAIL 
> > > > > PROTECTED]/private/full/..
> > > ."
> > > >
> > > > > I also wanted to mention that I'm using mono on Linux, which was
> > > > > originally giving me authentication problems because by default
> > > Mono
> > > > > blocks everything related to web requests.  I got past that
> > > problem by
> > > > > using the mozroots.exe program to add all Mozilla certificates to
> > > Mono
> > > > > ( http://www.mono-project.com/FAQ:_Security), which allows me to
> > > > > authenticate with Google, query events, and create events.  I
> > > figured
> > > > > that if I could get that far, then deleting an event shouldn't be
> > > a
> > > > > problem, but perhaps mono doesn't like me sending a feed request
> > > to
> > > > > that specific event uri?  That's probably not the case, but I just
> > > > > thought I'd mention it.
> > > >
> > > > > Thanks for helping me out :)
> > > >
> > > > > - Elliott
> > > >
> > > > > On Apr 1, 3:32 pm, "Ryan Boyd (Google)" < [EMAIL PROTECTED]>
> > > wrote:
> > > >
> > > > > > The good news is that it doesn't look like you're doing anything
> > >
> > > > > > fundamentally wrong :)
> > > >
> > > > > > However, I'm not quite sure what's causing the problem you're
> > > > > > experiencing.  It seems as if the client isn't getting a
> > > response back
> > > > > > from the server in a resonable period of time and is throwing an
> > >
> > > > > > exception.
> > > >
> > > > > > A few questions:
> > > > > >   1) How long is this taking to run?
> > > > > >   2) Are you doing anything else with your calendar while this
> > > is
> > > > > > running?  Ie, do you have another program running against the
> > > same
> > > > > > calendar.. or is this program running in multiple threads?
> > > > > >   3) Do you have any proxy servers in between your computer and
> > > Google
> > > > > > that you are aware of?
> > > >
> > > > > > Cheers,
> > > >
> > > > > > -Ryan
> > > >
> > > > > > On Apr 1, 1:35 pm, "ekun" <[EMAIL PROTECTED] > wrote:
> > > >
> > > > > > > Oops, I think I posted this on the wrong group originally, so
> > > if
> > > > > > > you're reading this again, my apologies... :)
> > > >
> > > > > > > Hi all,
> > > >
> > > > > > > I'm new to Google API's, so please pardon such a basic
> > > question.
> > > > > > > Basically, I just created a test function based off of the API
> > >
> > > > > > > Developers guide which would query an event from my calendar,
> > > and then
> > > > > > > delete it.  The query works fine so I know that my URI and
> > > > > > > CalendarService values are fine.  However, as soon as I try to
> > > delete
> > > > > > > the entry from the Calendar, I get a timeout exception at run
> > > time.
> > > > > > > Here's what my function looks like:
> > > >
> > > > > > > public static void queryCalendar(Uri calendarURI,
> > > CalendarService
> > > > > > > service)
> > > > > > > {
> > > > > > >         EventQuery myQuery = new EventQuery(
> > > calendarURI.ToString());
> > > > > > >         myQuery.Query = "Tennis";
> > > > > > >         EventFeed myResultsFeed = service.Query(myQuery);
> > > > > > >         if (myResultsFeed.Entries.Count > 0)
> > > > > > >         {
> > > > > > >                 AtomEntry firstMatchEntry =
> > > myResultsFeed.Entries[0];
> > > > > > >                 Console.WriteLine("Query found {0}",
> > > > > > > firstMatchEntry.Title.Text);
> > > >
> > > > > > >                 // Method 1: Causes a timeout exception at
> > > run-time
> > > > > > >                 myResultsFeed.Entries[0].Delete();
> > > >
> > > > > > >                 // Method 2: Causes a timeout exception at
> > > run-time
> > > > > > >                 //service.Delete( myResultsFeed.Entries[0]);
> > > >
> > > > > > >                 // Method 3: Causes a timeout exception at
> > > run-time
> > > > > > >                 // service.Delete(new
> > > > > > > Uri(myResultsFeed.Entries [0].EditUri.ToString()));
> > > >
> > > > > > >         }
> > > >
> > > > > > > }
> > > >
> > > > > > > The exception that I keep receiving looks like this:
> > > > > > > Unhandled Exception: Google.GData.Client.GDataRequestException
> > > :
> > > > > > > Execution of request 
> > > > > > > failed:http://www.google.com/calendar/feeds/[EMAIL 
> > > > > > > PROTECTED]/private/full/.
> > > ..
> > > > > > > ---> System.Net.WebException: The request timed out
> > > > > > >   at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult
> > > > > > > asyncResult) [0x00000]
> > > > > > >   at System.Net.HttpWebRequest.GetResponse () [0x00000]
> > > > > > >   at Google.GData.Client.GDataRequest.Execute () [0x00000] ---
> > > End of
> > > > > > > inner exception stack trace ---
> > > >
> > > > > > >   at Google.GData.Client.GDataRequest.Execute () [0x00000]
> > > > > > >   at Google.GData.Client.GDataGAuthRequest.Execute (Int32
> > > iRetrying)
> > > > > > > [0x00000]
> > > >
> > > > > > > Am I just doing something fundamentally wrong, or has someone
> > > else
> > > > > > > ever run into this problem.  Any help at all would totally be
> > > > > > > appreciated.  Thank you!!!
> > >
> > >
> > >
> > >
>
>
> --
> "Hexakosioihexekontahexaphobiacs is the term for people who fear the
> number 666"
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to