Thanks Ben,
Doing a GET for, say,
http://code.google.com/feeds/issues/p/abugadro/issues/1/comments/fullreturns
the code 200 (Success).
POSTing to that same url gets an error 400.
My current headers:
postRequest.addHeader("Content-Type","application/atom+xml;charset=UTF-8");
postRequest.setHeader("Authorization", "GoogleLogin auth=" + auth);
postRequest.addHeader("User-Agent",
"abugadro-v"+getResources().getString(R.string.version));
postRequest.addHeader("Accept-Encoding","gzip");
postRequest.addHeader("GData-Version", "1.0");//Got this from the actual
Java API
//postRequest.addHeader("If-Match", "*"); //Error 501 if enabled
The XML
String xml =
"<?xml version='1.0' encoding='UTF-8'?>" +
"entry xmlns='http://www.w3.org/2005/Atom' " +
"xmlns:projects='http://schemas.google.com/projecthosting/projects/2010' " +
"xmlns:issues='http://schemas.google.com/projecthosting/issues/2009'>"+
"<content type='html'>"+((EditText)
textEntryView.findViewById(R.id.comment_edit)).getText().toString()+"</content>"+
"<author>"+
"<name>"+authEmail+"</name>"+
"</author>"+
"</entry>";
The various ways I've attempted to send that xml:
StringEntity se = new StringEntity(xml,"UTF-8");
se.setContentType("application/atom+xml");
se.setChunked(true);
postRequest.setEntity(se); //Error 400.
List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("application/atom+xml", xml));
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(params,
HTTP.UTF_8);
postRequest.setEntity(formEntity); //Error 400 too.
:-/
I'm out of ideas.
On Wed, Sep 22, 2010 at 10:22 AM, Ben Collins-Sussman <[email protected]>wrote:
> As an experiment: try to do a successful GET of the issue comments
> feed without the auth, and then if that succeeds, try POSTing a new
> issue/comment with the same auth.
>
> On Tue, Sep 21, 2010 at 4:10 PM, Juan M. Rodriguez <[email protected]>
> wrote:
> > Ok,
> > I've reverse engineered the Java API up to a point.
> > I changed my headers to:
> > HttpPost postRequest = new
> > HttpPost("http://code.google.com/feeds/issues/p/
> "+projName+"/issues/"+issueId+"/comments/full");
> >
> postRequest.addHeader("Content-Type","application/atom+xml;charset=UTF-8");
> > postRequest.setHeader("Authorization", "GoogleLogin auth=" + auth);
> > postRequest.addHeader("User-Agent",
> > "abugadro-v"+getResources().getString(R.string.version));
> > postRequest.addHeader("GData-Version", "1.0");
> > And get various errors, 400 and 401 mostly. I noticed the Java API uses
> GZip
> > to send the data, is it really obligatory?
> > Thanks for your time.
> > On Sun, Sep 19, 2010 at 11:59 AM, Juan M. Rodriguez <[email protected]>
> > wrote:
> >>
> >> Hey Ben,
> >> I'm using the reference. The IssueTrackerAPIJava isn't really optimized
> >> for Android and would drag ~6mb of dependencies to an otherwise small
> apk.
> >> I'm currently just stuck at the comment-posting part. I've no idea what
> >> could be the problem, but I'm fairly certain its a headers issue, either
> it
> >> doesn't like how I'm sending the XML or it's something else.
> >> Thanks.
> >>
> >> On Sun, Sep 19, 2010 at 9:01 AM, Ben Collins-Sussman <
> [email protected]>
> >> wrote:
> >>>
> >>> Just a side question: are you using the official java library for
> >>> accessing the issue tracker's gdata?
> >>> (http://code.google.com/p/support/wiki/IssueTrackerAPIJava)?
> >>>
> >>> On Sat, Sep 18, 2010 at 11:15 PM, Nushio <[email protected]> wrote:
> >>> > Long story short: I'm working on an Android App that will let
> >>> > developers have access to their Google Code projects in a mobile
> >>> > friendly package. I'm trying to get commenting and creating issues
> >>> > from the Android device working, but I haven't found a way to do so.
> >>> >
> >>> > I keep getting different errors, 403, 501. I'm frankly tired,
> >>> > exhausted and out of ideas.
> >>> >
> >>> > My relevant piece of code:
> >>> >
> >>> > String xml =
> >>> > "<?xml version='1.0' encoding='UTF-8'?>" +
> >>> > "<entry xmlns='http://www.w3.org/2005/Atom' " +
> >>> > "xmlns:issues='
> http://schemas.google.com/projecthosting/issues/
> >>> > 2009'>"+
> >>> > "<content type='html'>"+((EditText)
> >>> >
> textEntryView.findViewById(R.id.comment_edit)).getText().toString()+"</
> >>> > content>"+
> >>> > "</entry>";
> >>> >
> >>> > StringEntity se = new StringEntity(xml,"UTF-8");
> >>> > se.setContentType("application/atom+xml");
> >>> >
> >>> > HttpPost postRequest = new HttpPost("http://code.google.com/feeds/
> >>> > issues/p/"+projName+"/issues/"+issueId+"/comments/full");
> >>> >
> >>> > postRequest.setHeader("Authorization", "GoogleLogin auth=" + auth);
> >>> > postRequest.addHeader("GData-Version", "3.0");
> >>> > postRequest.addHeader("If-Match", "*");
> >>> > postRequest.addHeader("Content-Type","application/atom+xml");
> >>> > postRequest.setEntity(se);
> >>> >
> >>> > HttpResponse response = new DefaultHttpClient().execute(postRequest);
> >>> >
> >>> >
> >>> > //Thanks very much for your help!
> >>> >
> >>> > --
> >>> > You received this message because you are subscribed to the Google
> >>> > Groups "Project Hosting on Google Code" group.
> >>> > To post to this group, send email to
> >>> > [email protected].
> >>> > To unsubscribe from this group, send email to
> >>> > [email protected]<google-code-hosting%[email protected]>
> .
> >>> > For more options, visit this group at
> >>> > http://groups.google.com/group/google-code-hosting?hl=en.
> >>> >
> >>> >
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Project Hosting on Google Code" group.
> >>> To post to this group, send email to
> >>> [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected]<google-code-hosting%[email protected]>
> .
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/google-code-hosting?hl=en.
> >>>
> >>
> >>
> >>
> >> --
> >> Ing. Juan M. Rodriguez Moreno
> >> Desarrollador de Sistemas Abiertos
> >> Sitio: http://proyectofedora.org/mexico
> >>
> >>
> >
> >
> >
> > --
> > Ing. Juan M. Rodriguez Moreno
> > Desarrollador de Sistemas Abiertos
> > Sitio: http://proyectofedora.org/mexico
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Project Hosting on Google Code" group.
> > To post to this group, send email to
> [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-code-hosting%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/google-code-hosting?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Hosting on Google Code" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-code-hosting%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-code-hosting?hl=en.
>
>
--
Ing. Juan M. Rodriguez Moreno
Desarrollador de Sistemas Abiertos
Sitio: http://proyectofedora.org/mexico
--
You received this message because you are subscribed to the Google Groups
"Project Hosting on Google Code" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code-hosting?hl=en.