Hi,

I have tried the following code to create map but its giving me Error
400:Content is not allowed in prolog.
Here is my code.

String feed ="<entry xmlns='http://www.w3.org/2005/
Atom'>"+"<title>First Map Created by Janaki</title>"+"<summary>Hey Hey
I Did it</summary>"+"</entry>";
URL   urlget = new URL("http://maps.google.com/maps/feeds/maps/
myuserid/full");
                        HttpURLConnection conget =(HttpURLConnection)
urlget.openConnection();
                        conget.setRequestProperty("Content-Type",
"application/atom+xml");
                conget.setRequestProperty("Content-Length",
Integer.toString(feed.length()));
                conget.setRequestProperty("Authorization","GoogleLogin
auth="+authtok); // auth contains my authentication token.
                        conget.setDoOutput(true);
                        conget.setDoInput(true);
                     Log.d("setRequestMethod","POST");

                        conget.setRequestMethod("POST");
                     Log.d("conget","connect");

                     conget.connect();
                     Log.d("conget","responsecode");

                 OutputStream outputStream = conget.getOutputStream();
                 outputStream.write(feed.getBytes());
                 outputStream.close();
                 int responseCode1 = conget.getResponseCode();
                 Log.d("reponsecode",Integer.toString(responseCode1));
                InputStream inputStream;

                 if (responseCode1 == HttpURLConnection.HTTP_CREATED)
{
                   inputStream = conget.getInputStream();
                 } else {
                   inputStream = conget.getErrorStream();
                 }
                 byte[] array=new byte[1024];
                        inputStream.read(array,0,1024);
                        String result=new String(array);
                     Log.d("result",result);

I am able to retrieve the list of maps but could not create map.
Can anybody help what am doing wrong , looking forward for your
replies

Regards

-- 
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

Reply via email to