7 messages in com.googlegroups.google-picasa-data-apiError creating New album| From | Sent On | Attachments |
|---|---|---|
| riz | 20 Dec 2007 04:55 | |
| riz | 20 Dec 2007 23:47 | |
| Ryan Boyd (Google) | 21 Dec 2007 07:00 | |
| Rizwan Zahid | 21 Dec 2007 10:42 | |
| Ryan Boyd (Google) | 21 Dec 2007 10:59 | |
| Rizwan Zahid | 21 Dec 2007 11:16 | |
| Ryan Boyd (Google) | 21 Dec 2007 11:18 |
| Subject: | Error creating New album![]() |
|---|---|
| From: | riz (rizc...@gmail.com) |
| Date: | 12/20/2007 04:55:48 AM |
| List: | com.googlegroups.google-picasa-data-api |
Hi ! I have tried the following code to create new Album but it gives me Exception
java.io.IOException: Server returned HTTP response code: 500 for URL: http://picasaweb.google.com/data/feed/api/user/userID at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at PicasaConnector.CreateAlbum(PicasaConnector.java:95) at PicasaConnector.main(PicasaConnector.java:122)
Code is (Java)
boolean CreateAlbum (String Token, String AlbumName){ URL url; InputStream fr = null;
int c ; try { url = new URL("http://picasaweb.google.com/data/feed/api/user/ userID");
URLConnection conn =(HttpURLConnection) url.openConnection(); // String encoding = Base64Converter.encode(Token.getBytes()) ; conn.setRequestProperty("Authorization", "GoogleLogin" + Token); // conn.setRequestProperty("content type", "application/atom+xml"); String feed = "<entry xmlns='http://www.w3.org/2005/Atom'"+ "xmlns:media='http://search.yahoo.com/mrss/'"+ "xmlns:gphoto='http://schemas.google.com/photos/2007'>"+ "<title type='text'>Trip To Italy</title>"+ "<summary type='text'>This was the recent trip I took to Italy.</ summary>"+ "<gphoto:location>Italy</gphoto:location>"+ "<gphoto:access>public</gphoto:access>"+ "<gphoto:commentingEnabled>true</gphoto:commentingEnabled>"+ "<gphoto:timestamp>1152255600000</gphoto:timestamp>"+ "<media:group>"+ "<media:keywords>italy, vacation</media:keywords>"+ "</media:group>"+ "<category scheme='http://schemas.google.com/g/2005#kind'"+ "term='http://schemas.google.com/photos/2007#album'></category>"+ "</entry>";
conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(feed); wr.flush();
fr = conn.getInputStream();
int len = conn.getContentLength();
while (((c=fr.read()) != -1) && (--len>0)) { System.out.print((char)c) ; } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
Can anybody help what am doing wrong , this is a part of my final year project so please guys response me ASAP. looking forward for your replies
Regards




