On Thu, Sep 18, 2008 at 8:49 AM, Carver42 <[EMAIL PROTECTED]> wrote:
>
> Trevor,
> I had a problem implementing the traffic file. My first step is to
> build a list of calendars and that is failing with a 401. Here is the
> code I used, I just added the last 5 lines. If I comment out those 5
> lines my code returns the list, so I am thinking that I am missing
> something:
>
> protected FxCalendarService _calService = new
> FxCalendarService(); // FxCalendarService is your calendar service
> renamed for intellisense, no changes
>
> public DSProviderGoogle(string userName, string password)
> : base(userName, password) {
>
>
> ((GDataRequestFactory)_calService.RequestFactory).KeepAlive = false;
>
> _calService.setUserCredentials(_UserName, _Password);
>
> GDataLoggingRequestFactory factory = new
> GDataLoggingRequestFactory("wise", "SpreadsheetsLoggingTest");
> factory.MethodOverride = true;
> factory.CombinedLogFileName = "c:\\temp\\xmllog.log";
> //Console.WriteLine("Log file name:" +
> factory.CombinedLogFileName);
> _calService.RequestFactory = factory;
>
> }
>
> I am getting a 401 - Unautorized. Here is the exception:
>
> Google.GData.Client.GDataRequestException was unhandled
> Message="Execution of request failed:
> http://www.google.com/calendar/feeds/default/allcalendars/full"
> Source="Google.GData.Client"
> ResponseString=""
> StackTrace:
> at Google.GData.Client.GDataRequest.Execute()
> at Google.GData.Client.GDataGAuthRequest.Execute(Int32
> retryCounter)
> at Google.GData.Client.GDataGAuthRequest.Execute()
> at Google.GData.Client.GDataLoggingRequest.Execute()
> at Google.GData.Client.Service.Query(Uri queryUri, DateTime
> ifModifiedSince, Int64& contentLength)
> at Google.GData.Client.Service.Query(Uri queryUri, DateTime
> ifModifiedSince)
> at Google.GData.Client.Service.Query(FeedQuery feedQuery,
> DateTime ifModifiedSince)
> at Google.GData.Client.Service.Query(FeedQuery feedQuery)
> at FlexSchedule.FxCalendarService.Query(CalendarQuery calQuery)
> in E:\DevelopmentResources\Visual Studio Projects
> \WindowsApplication10\WindowsApplication10\Data
> \calendarservice.cs:line 68
> at FlexSchedule.Data.DSProviderGoogle.GetCalFeed(CalendarQuery
> query, String eMail, String pw) in E:\DevelopmentResources\Visual
> Studio Projects\WindowsApplication10\WindowsApplication10\Data
> \DSProviderGoogle.cs:line 448
>
> and the internal Exception:
>
> The remote server returned an error: (401) Unauthorized.
>
> Here is the traffic file:
> Request at: 9/18/2008 8:43:33 AM
> GET to: http://www.google.com/calendar/feeds/default/allcalendars/full
> Header: Content-Type:application/atom+xml; charset=UTF-8
> Header: User-Agent:SpreadsheetsLoggingTest GDataGAuth-CS/1.0.0
> Header: Authorization:GoogleLogin
> auth=DQAAAHAAAAAWcapVKjVmsPuDNLYWANZF6xI4bTx45pdvtdFmrbJps4aZxTulB79ZoaBUpVofoDMaLljWdMcp5waTVQFkJDtJZWgnYiRn3uogMfye2Bh1Jqpf-
> wFmMHrz-zB-3T_e3J24M1CyST1jKPsVl1fGuJwg
> Response received at: 9/18/2008 8:43:33 AM
> Header: Content-Length:149
> Header: Cache-Control:private, max-age=0
> Header: Content-Type:text/html; charset=UTF-8
> Header: Date:Thu, 18 Sep 2008 15:43:32 GMT
> Header: Expires:Thu, 18 Sep 2008 15:43:32 GMT
> Header: Server:GFE/1.3
> Header: WWW-Authenticate:GoogleLogin realm="https://www.google.com/
> accounts/ClientLogin", service="cl"
> <HTML>
> <HEAD>
> <TITLE>Token invalid</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> <H1>Token invalid</H1>
> <H2>Error 401</H2>
> </BODY>
> </HTML>
>
>
> Bob
Hi Bob,
Sorry for the delay responding. It seems that the problem is this line:
GDataLoggingRequestFactory factory = new
GDataLoggingRequestFactory("wise", "SpreadsheetsLoggingTest");
The first argument to the GDataLoggingRequestFactory is the service
name used for ClientLogin. When talking to Calendar, this has to be
set to "cl" ("wise" is the service name for the Spreadsheets API)
otherwise the server will reject your token.
--
Trevor Johns
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---