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. info about CTS

Hi,

Can anyone tell me where can I get the documentaiton about CTS on

1.how to build CTS from source code..
2. how to run CTS

Thanks
raj

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Displaying Virtual Keyboard without expanding EditText

I think this works:

InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(
                                Context.INPUT_METHOD_SERVICE );
                inputMethodManager.showSoftInput ( yourEditText,
InputMethodManager.SHOW_FORCED );

you might have to force the edittext to be focused by running
"yourEditText.requestFocus()" first, Im not sure.

cheers,




-- 

3. How can i use DragLayer.java to drag and drop my own ListView items

4. Reason for location listener becomes null ??

5. Possible Android 2.x Browser/WebView regression bug

6. how to monitor sim has been changed?

7. if second application installed on phone then first will not found