Hi Bala, Thanks..
I've changed my HTTP request as you mentioned it. The problem persist though... error 400. The code that I'm using now are in the reply to Lane below .. regards, -yijie- On Jun 5, 10:25 pm, Bala <[EMAIL PROTECTED]> wrote: > Hi John, > > I think the output stream data part is incorrect, you should write only the > post data in the output stream. I don't know how to do it in java. But, > there has to be some way of setting the request headers with the connection > object. > > The post body section, or the output stream should contain only the > following: > > data = " <entry xmlns='http://www.w3.org/2005/Atom'... (the sample > xml code from the Developer's Guide: Protocol) ... </entry>" > > Hope this will help! > > Regards, > Bala > > On 6/4/07, John Doe <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi there, I need help with this rather fundamental task here but I'm > > an absolute newbie at communicating using HTTP requests. > > > I need to add/edit/delete calendar events on my JSP site. I know I shd > > be using the Java Client Library but for some reason I have to stick > > to java 1.4.2 (gdata runs on ver 1.5 though) on my server so I need to > > find some other ways of doing it. > > > So right now I'm trying to do things using the java URLConnection > > object. > > > ~~~~~~~~~~~~~~~ > > String xmlfeed = > > http://www.google.com/calendar/feeds/[EMAIL PROTECTED]/private-(magic > > cookie)/basic > > URL url = new URL(xmlfeed); > > URLConnection conn = url.openConnection(); > > conn.setDoOutput(true); > > > BufferedReader rd = new BufferedReader(new > > InputStreamReader(conn.getInputStream())); > > while ((line = rd.readLine()) != null) { out.println(line); } > > rd.close(); > > ~~~~~~~~~~~~~~~ > > > by doing this, i can retrieve and print out the XML contents of my > > calendar. > > > However, I have no idea how to format and send a POST request to my > > XML feed. > > > I tried : > > ~~~~~~~~~~~~~~~~ > > String data = "POST " + xmlfeed; > > data += " <entry xmlns='http://www.w3.org/2005/Atom'... (the sample > > xml code from the Developer's Guide: Protocol) ... > " > > OutputStreamWriter wr = new > > OutputStreamWriter(conn.getOutputStream()); > > wr.write(data); > > wr.flush(); > > ~~~~~~~~~~~~~~~~~ > > > The response that I received was a HTTP/1.0 400 Bad Request . > > > Can anyone guide me on what I should do to submit a proper request? > > I've searched through the forums and references, but everybody seems > > to know how to do it, except for me apparently. > > > many thanks in advance.. > > -- > Thanks and Regards, > Balaram Barange- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
