I'm trying to implement the create calendar protocol from Google Calendar. For that I'm supposed to do a HTTPPost to owncalendar url, with auth header and content-type given. After performing HttpPost, i get a response saying "411 length required".. But when I checked packets using wireshark, the content-length is added, I tried to add it manually, but it is not allowing me to do so and raises an exception saying content-length already added. So how do i go about it? check this code
------------------------Code here-------------------------------------- String body="<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'>"+title+"</title>" + "<summary type='text'>"+summary+"</summary>" + "<gCal:timezone value='"+timezone+"'></gCal:timezone>"+ "<gCal:hidden value='"+String.valueOf(hidden)+"'></ gCal:hidden>"+ "<gCal:color value='"+color+"'></gCal:color>"+ "<gd:where rel='' label='' valueString='"+location+"'></ gd:where>"+ "</entry>"; String url="http://www.google.com/calendar/feeds/default/ owncalendars/full"; final HttpPost mPost=new HttpPost(url); mPost.addHeader("Content-type","application/atom+xml"); mPost.addHeader(AUTH_HEADER_NAME,AUTH_HEADER_VALUE); // mPost.removeHeaders("Content-Length"); // mPost.setHeader("Content-Length", String.valueOf(body.length())); Header[] mHeaders1=mPost.getAllHeaders(); for(int i=0;i<mHeaders1.length;i++) { System.out.println(" Header as follow -->"+mHeaders1[i].getName()+" val=>"+mHeaders1[i].getValue()); } try { HttpEntity entity = new StringEntity(body); HttpClient mClient= new DefaultHttpClient(); HttpProtocolParams.setUseExpectContinue(mClient.getParams(), false); mPost.setEntity(entity); HttpResponse mResponse; mResponse= mClient.execute(mPost); System.out.println("THE SUCCESS CODE IS AS FOLLOWS"+mResponse.getStatusLine().getStatusCode()+mResponse); ------------------------ THe rest follows -------------------------------------- -- 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