Hi! I try to update status on Twitter from my application, using Apache Commons HttpClient. I'm totally new to the Twitter API so probably I'm doing something wrong, but can't figure out what is the problem. I tried to do everything like it was explained in API documentation, but get "Your browser sent a request that this server could not understand" message without any additional information. Could you please look on the logs below and tell what am I doing wrong?
Thanks in advance, Marcin [DEBUG] 2008-11-28 11:09:04,265 org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter http.protocol.content-charset = UTF-8 [DEBUG] 2008-11-28 11:09:04,265 org.apache.commons.httpclient.HttpMethodDirector - Preemptively sending default basic credentials [DEBUG] 2008-11-28 11:09:04,265 org.apache.commons.httpclient.HttpMethodDirector - Authenticating with BASIC <any realm>@twitter.com:80 [DEBUG] 2008-11-28 11:09:04,265 org.apache.commons.httpclient.params.HttpMethodParams - Credential charset not configured, using HTTP element charset [DEBUG] 2008-11-28 11:09:04,265 org.apache.commons.httpclient.HttpConnection - Open connection to twitter.com:80 [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "POST statuses/update.xml HTTP/1.1[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 org.apache.commons.httpclient.HttpMethodBase - Adding Host request header [DEBUG] 2008-11-28 11:09:06,140 org.apache.commons.httpclient.HttpMethodBase - Default charset used: UTF-8 [DEBUG] 2008-11-28 11:09:06,140 org.apache.commons.httpclient.HttpMethodBase - Default charset used: UTF-8 [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "Authorization: Basic xxx[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "User- Agent: Jakarta Commons-HttpClient/3.1[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "Host: twitter.com[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "Content- Length: 89[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "Content- Type: application/x-www-form-urlencoded[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.header - >> "[\r][\n]" [DEBUG] 2008-11-28 11:09:06,140 httpclient.wire.content - >> "status=Testing+Toaster+with+Twitter+crossposting+after +NullPointerException+fix...+%3A%29" [DEBUG] 2008-11-28 11:09:06,140 org.apache.commons.httpclient.methods.EntityEnclosingMethod - Request body sent [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "HTTP/1.1 400 Bad Request[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "HTTP/1.1 400 Bad Request[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "Date: Fri, 28 Nov 2008 10:09:08 GMT[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "Server: Apache[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "Vary: Accept-Encoding[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "Content- Length: 226[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "Connection: close[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "Content- Type: text/html; charset=iso-8859-1[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.header - << "[\r][\n]" [DEBUG] 2008-11-28 11:09:06,343 org.apache.commons.httpclient.HttpMethodBase - Default charset used: UTF-8 [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "<! DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">[\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "<html><head>[\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "<title>400 Bad Request</title>[\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "</ head><body>[\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "<h1>Bad Request</h1>[\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "<p>Your browser sent a request that this server could not understand.<br /> [\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "</p> [\n]" [DEBUG] 2008-11-28 11:09:06,343 httpclient.wire.content - << "</body></ html>[\n]" [DEBUG] 2008-11-28 11:09:06,343 org.apache.commons.httpclient.HttpMethodBase - Should close connection in response to directive: close [DEBUG] 2008-11-28 11:09:06,343 org.apache.commons.httpclient.HttpConnection - Releasing connection back to connection manager.
