Don't bother, already found the problem. Forgot to add the actual payLoad to the HTTPRequest using the setPayload method.
Gero On Feb 14, 10:30 pm, Gero <[email protected]> wrote: > Hi, > > I'm using the Scala code snippet below to post to Twitter from a GAE > application. > > val credentials = "XXXXX" // Base64 encoded version > of username:password > val req = new HTTPRequest(new URL("http://twitter.com/statuses/ > update.xml"), HTTPMethod.POST) > req.addHeader(new HTTPHeader("Authorization", "Basic " + > credentials)) > > // Following headers are added as a attempt to get it working, no > luck though > req.addHeader(new HTTPHeader("Host", "twitter.com")) > req.addHeader(new HTTPHeader("Accept", "*/*")) > req.addHeader(new HTTPHeader("Content-Type", "application/x-www- > form-urlencoded")) > > val resp = fetcher.fetch(req) > > This always results in a 403 response code suggesting that username/ > password are not correct. > > To ensure the credentials are OK I used the following simple curl > command to see what should be posted: > curl -v -u USER:PASS -d status="test > ab"http://twitter.com/statuses/update.xml > (Replace USER:PASS with real username/password). > > This command dumps the headers being posted and these are exactly the > same as the ones I included the above Scala code. > > Any suggestions what the problem might be? Or is Twitter blocking > requests from GAE in general? > > Thanks, > Gero -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" 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-appengine-java?hl=en.
