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. how to add data from textbox to database?

Hi everyone,
i am completely new to dis field.can anyone can give me some idea that
how to add data from textbox to database?
--~--~---------~--~----~------------~-------~--~----~

2. Install Google Android SDK on Ubuntu

I am very new to Ubuntu - I moved over from vista not more than 2weeks
ago. I am interested in installing the SDK for the Google Android,
however I can't figure out how. Can someone please help me?

Found on Googles Web Site (<a href="http://code.google.com/android/
intro/installing.html"> Installing The SDK,The instructions say:</a>

" # On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a
line that sets the PATH environment variable and add the full path to
the tools/ directory to it. If you don't see a line setting the path,
you can add one:

export PATH=${PATH}:<your_sdk_dir>/tools"

I have no idea how to do the above, please help

--~--~---------~--~----~------------~-------~--~----~

3. sms text questions

4. EditText Right Align

5. Barcodes

6. ServiceState

7. How to use my custom library apk file in other applications.