hi, guys,
  I tried to upload a xls file to google documents from a windows
mobile device, but I always get the following error:
==> "The remote server returned an error: (500) Internal Server
Error."

  I am sure that I get a correct authenticating because I can
sucessfully get the document list. I make the post content identical
to the tutorial.
  I tried the java library, it works great. Then I capture the ip
packet and fill in my post body as it does, still get the 500 error.
the main part of java library sent to upload a new xls looks like
following:
--------------------------------------------------------------------------------------------------------------------------
<entry xmlns='http://www.w3.org/2005/Atom'>
    <category scheme='http://schemas.google.com/g/2005#kind'
     term='http://schemas.google.com/docs/2007#spreadsheet'
label='spreadsheet'>
   </category>
   <title type='text'>test.xls</title>
   <content type='application/vnd.ms-excel'>
   </content>
</entry>\r\n"

while the guide's main part looks like
------------------------------------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom";>
  <atom:category scheme="http://schemas.google.com/g/2005#kind";
      term="http://schemas.google.com/docs/2007#spreadsheet"; />
  <atom:title>example spreadsheet</atom:title>
</atom:entry>

anyway both of them doesn't work for me, can any body give me an
working example?


And I paste my code if it helps
==============================================================
                StreamReader sr1 = new StreamReader("test.xls");
                String xlsStrData = sr1.ReadToEnd();
                ASCIIEncoding encoding = new ASCIIEncoding();

                String postBodyStr =
                    "--END_OF_PART\r\n" +
                    "Content-Type: application/atom+xml\r\n" +
                    "\r\n" +

                    "<entry xmlns='http://www.w3.org/2005/
Atom'><category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/docs/2007#spreadsheet'
label='spreadsheet'></category><title type='text'>test.xls</
title><content type='application/vnd.ms-excel'></content></entry>\r\n"
+
                    //"<?xml version='1.0' encoding='UTF-8'?>\r\n" +
                    //"<atom:entry xmlns:atom='http://www.w3.org/2005/
Atom'>\r\n" +
                    //"<atom:category scheme='http://
schemas.google.com/g/2005#kind' term='http://schemas.google.com/docs/
2007#spreadsheet' />\r\n" +
                    //"<atom:title>example spreadsheet</atom:title>\r
\n" +
                    //"</atom:entry>\r\n"+
                    "--END_OF_PART\r\n" +
                    "Content-Type: application/vnd.ms-excel\r\n" +
                    "\r\n\r\n\r\n" + xlsStrData + "\r\n" +
                    "--END_OF_PART--\r\n";


                byte[] postBodyData =
encoding.GetBytes(postBodyStr);


                HttpWebRequest req =
(HttpWebRequest)WebRequest.Create(url);
                req.Method = "POST";
                req.ContentLength = postBodyData.Length;
                req.ContentType = "multipart/related;boundary=
\"END_OF_PART\"";
                //req.AllowAutoRedirect = true;
                //req.AllowWriteStreamBuffering = true;

                String op = "Authorization: GoogleLogin ";
                op += token;
                req.Headers.Add(op);
                req.Headers.Add("Slug: test.xls");

                //req.Headers.Add("Accept-Encoding: gzip");
                //req.Headers.Add("Cache-Control: no-cache");
                //req.Headers.Add("Pragma: no-cache");
                //req.Accept = "Accept: text/html, image/gif, image/
jpeg, *; q=.2, */*; q=.2";
                //req.Headers.Add("MIME-version: 1.0");




                Stream postbody = req.GetRequestStream();
                postbody.Write(postBodyData, 0, postBodyData.Length);
                postbody.Close();

                WebResponse result = req.GetResponse();
=======================================================================
thanks ahead


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to google-help-dataapi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to