Error 400,content is not allowed in prolog

by jan » Sun, 07 Mar 2010 03:43:25 GMT


Sponsored Links
 I have tried the following code to create map in android 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</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

--



Error 400,content is not allowed in prolog

by janaki » Fri, 12 Mar 2010 01:46:51 GMT


 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

--


Sponsored Links


Other Threads

1. Flyscreen in Market!!!

Barusan cek market eh ada flyscreen..



--- Sent with SEVEN on Android - the new generation of mobile messaging

--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:
 

2. Listen from google labs

When I do adb logcat I see debug messages from Google Labs Listen app
I thought they recommend we remove debug logs for release.
They also print my email in log, which might be security problem?
--~--~---------~--~----~------------~-------~--~----~

3. sending an SMS and an e-mail.

4. Newbie question - firmware version

5. Porting Java app to Android--the basics

6. DDMS doesn't show process list on device

7. can I get XML information step by step using SaxParser??