title: 401 response when reading tweets
body: <p>I'm new to mobile apps development. I'm developing a blackberry application which reads tweets from the user's timeline. So far I managed to get the OAuth access token. The problem happens when I try to use this access token to read the tweets I get a 401 response with a message "Unauthorized". I'm not using any libraries I'm doing everything on my own. Could anyone help me with this?</p>
  
  <p>Thanks,</p>
  
  <p>Here's the code:</p>
  
  <pre><code>            HttpConnectionFactory factory = new HttpConnectionFactory( url,   
                  HttpConnectionFactory.TRANSPORT_WIFI |
                  HttpConnectionFactory.TRANSPORT_WAP2 |
                  HttpConnectionFactory.TRANSPORT_BIS |
                  HttpConnectionFactory.TRANSPORT_BES |
                  HttpConnectionFactory.TRANSPORT_DIRECT_TCP);
  
          httpConn = factory.getNextConnection();
          httpConn.setRequestMethod(HttpProtocolConstants.HTTP_METHOD_GET);
          httpConn.setRequestProperty("WWW-Authenticate","OAuth realm=http://twitter.com/");
          httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
          httpConn.setRequestProperty("Content-Length", Integer.toString(header.getBytes().length));
          os = httpConn.openOutputStream();
  
          os.write(header.getBytes());
          os.close();
          os = null;
  
  
          input = httpConn.openDataInputStream();
          int resp = httpConn.getResponseCode();
  
       //   Dialog.alert(httpConn.getDate()+" : "+System.currentTimeMillis());
  
  
          if (resp == HttpConnection.HTTP_OK) {
  
              XMLReader parser;
              try {
                  parser = XMLReaderFactory.createXMLReader();
                  parser.setContentHandler(this);
                  parser.parse(new InputSource(input));
                  for(int i=0 ; i&lt;2 ; i++)
                  {
                      tweets.addElement( parser.getProperty("text").toString());
                      Dialog.alert(parser.getProperty("text").toString());
                  }
  
              } catch (SAXException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              Dialog.alert("your tweet was posted successfully :)");
          }
          Dialog.alert(httpConn.getResponseCode()+": "+httpConn.getResponseMessage());
          return (httpConn.getResponseCode()+": "+httpConn.getResponseMessage()); 
      } catch (IOException e) {
          return "exception";
      } catch (NoMoreTransportsException nc) {
          return "noConnection";
      } finally {
          try {
              httpConn.close();
              input.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  </code></pre>