hi nikhil i was wondering if you have solve the issue with inserting , deleting and updating event , i am currently woking on a project which need to do the same , i getting the 200 status code when i post the entity to google server, any help will be appreciated ---------email faithfullgh...@gmail.com
On Jan 22, 10:56 am, Nikhil Agarwal <nikhil.dontpa...@gmail.com> wrote: > I request the developers to please look into this problem. Am I > sending the request correctly? > Thank you. > > On Jan 21, 7:22 pm, Nikhil Agarwal <nikhil.dontpa...@gmail.com> wrote: > > > > > I need to insert,update,delete events ingooglecalendarusing > >android. I tried using the protocol given > >athttp://code.google.com/apis/calendar/data/2.0/developers_guide_protoc... > > but I was unable to go beyond authenticating the user. > > > I was able to authenticate the user and I extracted the Auth code > > using:- > > temp1 = EntityUtils.toString(response.getEntity()); > > if(response.getStatusLine().getStatusCode()==200) > > auth = temp1.substring(temp1.indexOf("Auth=")+5).trim > > (); > > > After this I tried inserting aneventwhich did not work. I was > > getting status code 200 in response and I am not sure even if I did > > get a proper response, how can I extract the cookie s and gsessionid > > for my next request. > > > I triedcreatingacalendarinstead and I received the same status > > code 200. I used the following code:- > > > String messageBody="<entry xmlns='http://www.w3.org/2005/Atom'"+ > > " xmlns:gd='http://schemas.google.com/g/2005'"+ > > " xmlns:gCal='http://schemas.google.com/gCal/2005'>"+ > > " <title type='text'>ABC Project Schedule</title>"+ > > " <summary type='text'>Thiscalendar...</summary>"+ > > " <gCal:timezone value='Singapore/Asia'></gCal:timezone>"+ > > " <gCal:hidden value='false'></gCal:hidden>"+ > > " <gCal:color value='#2952A3'></gCal:color>"+ > > " <gd:where rel='' label='' valueString='Lab'></gd:where>"+ > > " </entry>"; > > StringEntity entity =new StringEntity(messageBody); > > entity.setContentType("application/atom+xml"); > > entity.setChunked(true); > > httppost.setEntity(entity); > > httppost.setHeader("Authorization", "GoogleLogin > > auth="+auth); > > httppost.setHeader("GData-Version", "2"); > > //httppost.setHeader("Content-Length",String.valueOf > > (entity.getContentLength())); > > //httppost.setHeader("Content-Type", "application/atom > > +xml"); > > HttpResponse response = httpclient.execute(httppost); > > > As can be seen from the code, I commented Content-Length and Content- > > Type as otherwise I would get a ClientProtocolException (content- > > length was causing the exception, didn't put content-type since it is > > already mentioned in the entity...not sure where it should be > > defined). > > > I am sorry that I don't understand the basics correctly. I did refer > > to the apache site for httpclient stuff but it wasn't of much help. > > Please help me out with the above problems. Thank you. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en