Background:

I am using Signpost (http://code.google.com/p/oauth-signpost/wiki/
TwitterAndSignpost) to try and post some updates to Twitter via oAuth.

I get through the oAuth authentication just fine, get my access token
and secret and make sure they are loaded into the Consumer object. I
then create my POST message and I get a 200 OK message back, but when
I dig into the stream, I see a 500 error.

Relevant code:

String data = "status=testing post";
URL url = new URL("http://twitter.com/statuses/update.xml";);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
consumer.sign(request);
request.setRequestMethod("POST");
request.setDoOutput(true);
request.setRequestProperty("Content-type", "text/xml; charset=" +
"UTF-8");
request.setDoInput(true);
request.connect();
OutputStream out = request.getOutputStream();

BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out,
"UTF-8"));
writer.write(data);
writer.close();

System.out.println(request.getResponseCode()+ " " +
request.getResponseMessage()); //THIS RETURNS 200 OK

InputStream in = request.getInputStream();
try
{
        Reader reader = new InputStreamReader(in);
        pipe(reader, tex);
        reader.close();
}

Pipe() is just a helper method to run the data from reader to a
writer. It's spitting out this:

Status: 500 Internal Server Error
Content-Type: text/html

<html><body><h1>500 Internal Server Error</h1></body></html>Status:
500 Internal Server Error
Content-Type: text/html

<html><body><h1>500 Internal Server Error</h1></body></html>

and the status is not showing up on the user timeline.

Any thoughts?

Reply via email to