HttpConnection doesn't work (with username and password)

I'm trying to get the tweet content (where I login account, say 'username' and 'password')

using the rest of the code and does not work.

According to the flow of Code, I do not get the answer for the POSITION

Int State = httpConn.getResponseCode ();

I tried to capture an Ethereal trace on my laptop and I don't see any HTTP POST also.

So I think that I get no response to the HTTP POST.

I don't know what the problem is. Is there any problem in SET UP?

I use the Simulator (9550). Version of the JDK BlackBerry 5.0.0.14

Note: If open the browser in the Simulator and use the same URL that is used in the Code, I get answer and ask user name and password. Once I entered the username and password. I get valid data to tweet.

Can someone help me in this context

class SocialContentMessage extends Thread {

    private String _AuthenticationHash;
    private String _CompleteUrl;
    private ExtendedTextBoxField _MessageField;

    public SocialContentMessage(final ExtendedTextBoxField messageFieldLocal) {
        _MessageField = messageFieldLocal;
        _AuthenticationHash = getAuthData("username","password");
    }

    public void run() {
        getUpdates("http://twitter.com/statuses/friends_timeline.xml");
    }

    private String getAuthData(String userName, String userPassWord) { 

        // Update authentication hash from current userName & userPassWord.
        byte[] toEncode = (userName + ":" + userPassWord).getBytes();
        ByteArrayOutputStream newHash = new ByteArrayOutputStream(toEncode.length);
        Base64OutputStream base64OutputStream = new Base64OutputStream(newHash);

        try {
            base64OutputStream.write(toEncode, 0, toEncode.length);
            base64OutputStream.flush();
            base64OutputStream.close();
        } catch (IOException ioe) {
            // Null out hash.
            newHash = null;
        }

        // Set authentication hash, clear password.
        return newHash.toString();
    }

    private final void getUpdates(String url) {

        try {

            // Open stream and poll data
            // Create post data
            URLEncodedPostData post = new URLEncodedPostData("", false);

            // Create connection
            StreamConnection s = null;
            _CompleteUrl = url + "?" + post.toString();
            s = (StreamConnection)Connector.open(_CompleteUrl, Connector.READ_WRITE, true);
            HttpConnection httpConn = (HttpConnection)s;
            httpConn.setRequestProperty(HttpProtocolConstants.HEADER_AUTHORIZATION,
                    "Basic "+_AuthenticationHash);

            // Connect and check status
            int status = httpConn.getResponseCode();

            //W. 8.7.K9 handle redirects: Twitter has been using these to combat DoS attacks the past few days
            if (status == HttpConnection.HTTP_TEMP_REDIRECT || status == HttpConnection.HTTP_MOVED_TEMP || status == HttpConnection.HTTP_MOVED_PERM) {
                String newURI = httpConn.getHeaderField("Location");
                if (newURI != null) {
                    //great, we have the new URL: go get it
                    s = null;
                    httpConn = null;
                    _CompleteUrl = newURI + "?" + post.toString();
                    s = (StreamConnection)Connector.open(_CompleteUrl, Connector.READ_WRITE, true);
                    httpConn = (HttpConnection)s;
                    httpConn.setRequestProperty(HttpProtocolConstants.HEADER_AUTHORIZATION,
                            "Basic "+_AuthenticationHash);
                    status = httpConn.getResponseCode();
                } else {
                    //give it a second to populate
                    long begin_wait = System.currentTimeMillis();
                    while (System.currentTimeMillis() - begin_wait < 1000 || status != HttpConnection.HTTP_OK) {
                        try {
                            sleep(100);
                        } catch (InterruptedException e) {
                            // Couldn't sleep
                        }
                        status = httpConn.getResponseCode();
                    }
                }
            }

            if (status == HttpConnection.HTTP_OK) {
                // Log success
                // Create element, null connection for testing
                StringBuffer out = new StringBuffer();
                InputStream in = httpConn.openInputStream();
                byte[] b = new byte[4096];
                for (int n; (n = in.read(b)) != -1;) {
                    out.append(new String(b, 0, n));
                }
                String test = out.toString();
                // end for testing

                httpConn.close();
                httpConn = null;
                s = null;

            } else {
                // Log failure
            }
        } catch (IOException e) {
            // Log IO Exception
        }
    }
}

Problem is resolved now...

I don't know that I need to use the MDS Simulator before starting my program...

I got the information of existing Questions...

Tags: BlackBerry Developers

Similar Questions

  • How to set up Windows Mail with username and password. Error: 0x800CCC67

    How do you get the Window Mailer program to send emails after selecting the tab allow; provide the subject the text fields with his concerns, and then select the tab send. only to be routed to the dialog of POP3 asking "user name and pass word" not knowing what the old man and or (how to) a username and/or password?  The last error message I received contained the 0x800CCC67 error number. I currently have 15 messages waiting to be sent, 14 of them are since and worms, tries to send to different ententies.

    Original title: Mailer Windows has not worked for me yet. whenever I get an error message in the program of POP3 and the last error number is 0x800CCC67. In addition, how its "username and password" if we had a time or needs to be reset?

    Before you can configure an e-mail account, you must call your ISP or your e-mail server.
    You need the following:

    E-mail address
    Username
    Password
    Name of the incoming server
    The name of the outgoing server

    Also ask them if they can either teach you how to configure an e-mail account, or if they have a website where he shows how to do.

    Assuming you use Windows Mail, snce you wrote 'Mailer Windows', here's a tutorial:

    Windows Mail: setting up upan account from beginning to end
    http://Windows.Microsoft.com/en-CA/Windows-Vista/Windows-mail-setting-up-an-account-from-start-to-finish For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • How to restrict access with usernames and passwords?

    I'm an intern in a manufacturing company who hired me to do a series of tutorials using Captivate.  The goal is to have a handful of employees (scattered throughout the world) to be able to go to the company Web site and take the tutorials & quizzes that I do.  I played with the advanced options vary a bit to get a feel for them, but I'm not finding what I need.  The employee that the company chooses to take these courses online should be able to sign in with a username and a password for a page that contains the courses listed there.

    Should I get our server/Web site managers to code all this, or is it easier (and it would make more sense) to make a presentation of Captivate referring to a list of the specific company e-mail address and allows them only these email address to have a user name and password created for her.  From this point, once the user connects, they see hyperlinks to the online course, they need to take.

    Any input on this would be very useful and thanks in advance!

    Close enough...

    And LMS is not the ONLY way to follow the scores and information, it is just the most common these days.

    Captivate allows alternatives, as for an acrobat.com account as you point out, or you can create a custom report page:

    http://help.Adobe.com/en_US/Captivate/CP/using/WS5b3ccc516d4fbf351e63e3d119e958285f-8000.h tml #WS365a66ad37c9f510-67fa130d1265cad66a2-7fff

    However, these methods do not provide for any security from the start.

    If your TI people are ready to set up a folder protected by password on your Web server and you configure your lessons to Captivate him make the acrobat.com account or a custom report page, perhaps you could accomplish what you need fairly easily (low cost). However, this approach can specifically permits not to track people. If you have a site with one generic login (i.e. the user: password), you can just about anyone with this user/pass. If you want each user to have their own username and password, which becomes much more complex. Can your IT configuration guy such a login page that syncs with a centralized database users (e.g. Active Directory)?

    So how do follow you that user through Captivate so the results of the lesson are recorded for the related user on your personalized page?

    It starts to get complicated, so an LMS may be easier:

    Moodle is a very popular, free LMS.

    http://Moodle.org

    Installation can be something internally (find a server, find people to install), but there are people out there who offer to host it for you.

    Here are some more:

    http://www.openelms.org/

    http://sakaiproject.org/

    There are also a variety of LMS commercial products out there, costs vary widely.

    This is what we use: http://www.inquisiqR3.com (link prices are on this page)

    Otherwise, here is a list of good references where you can choose a variety of filtering criteria.

    http://www.Capterra.com/learning-management-system-software

    Hope that helps!
    Erik

  • Is it possible to create a personal space by logging in with username and password?

    Hi all

    Is it possible to create a personal space by logging in with the user name and password?

    in the Web of Muse site

    Thanks in advance for any response

    Hello

    A related thread for more ideas are

    Login using Muse and British Colombia page

    Re: Can I create a login/password in the Muse for a HTML5 page or two?

    How to create an entry page protected password for a site of muse?

    https://forums.Adobe.com/thread/1175323

    Hope this helps

  • Satellite P300 (PSPCCA) - fingerprint reader doesn't work with IE8

    Fingerprint reader worked very well for all websites accessible Internet Explorer 7 vi.
    Then upgraded to IE8, fingerprint software has stopped working in IE. Uninstalled the old software of fingerprint and a downloaded from the toshiba site - updated version still does not.

    Does anyone have a similar experience?

    Hello

    As far as I know the old fingerprint software doesn't work with IE8 and Firefox 3
    You will have to wait for the update.
    I m not very well what version it will be, but I think soemthing with 3.0 or higher

  • I finished the installation of Sharepoint 2010 and he is told to use the username and password you loged on the server with does not work. What should I do to access the sharepoint URL?

    I finished the installation of Sharepoint 2010 and went through the Setup Wizard. It is said to use the username and password you loged on the server with does not work. What should I do to access the sharepoint URL?

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet Forum. You can follow the link to your question:
    http://social.technet.Microsoft.com/forums/en-us/sharepoint2010general/threads

  • Tried to open a PDF with Acrobat Pro Trial XI and sign popped up, I entered my username and password, but he doesn't answer his similar gray with the four points of rotation for ever. Any solution please?

    Tried to open a PDF with Acrobat Pro Trial XI and sign popped up, I entered my username and password, but he doesn't answer his similar gray with the four points of rotation for ever. Any solution please?

    Hi higi97,

    How are you connected to the internet? You're behind a corporate firewall particularly safe? You're on Mac or Windows? You have an anti-malware software running on your computer which can prevent applications other than your browser to connect to internet?

    You can try the steps below:

    1. close the application of creative cloud.

    2. navigate to the OOBE folder.

    Windows: [system drive]: \Users\ [user name] \AppData\Local\Adobe\OOBE

    Mac OS: /Users/ [user name] / folder/Library/Application Support / Adobe / OOBE

    3. delete the opm.db file.

    4. launch creative cloud.

    Let us know if this helps,

    Kind regards

    Rave

  • Windows Mail keeps asking for my username and password, and even if they are correct he still doesn't and comes repeatedly asks me for the info

    That makes me MAD! Windows Mail - checking the user name and password &!

    It makes me crazy.

    For the last few days my Windows Mail keeps asking for my username and password and even if they are correct it still doesn't and comes repeatedly asks me for the info again and again. I deleted the account mail twice now and re added it but it still does not work. I can send emails but not receive. I have McAfee but I aiinstalle only this yesterday so that isn't the problem. the error message is:-
    Account: 'mail.talktalk.net', server: 'mail.talktalk.net', Protocol: POP3, server response: '-ERR Authentication failed.', Port: 110, secure (SSL): no, Server error: 0x800CCC90, error number: 0x800CCC92

    Please help I need to retrieve my emails! Thanks, Sarah

    McAfee is a huge problem with Windows Mail.  See www.oehelp.com/OETips.aspx#3 if you want to use, wait until you get the job of Winmail.

    Check if you can connect webmail and that works very well and it's not a problem on the end of the server messaging or because of misspelled powers.  Then delete your account in WinMail, compact and repair the database (see www.oehelp.com/WMUtil/) and make sure that you have disabled the e-mail analysis then add your account to mail back again and see if it works.

    Steve

  • When they surf on the web as an administrator, Firefox remembers usernames and password, but when words I surfed as a standard user, it doesn't.

    Before Firefox updated to 6, my user ID and passwords that I had saved, or ask the site to remember was always available. If I close the browser and later began a new session, my ID's were still on the Web site when I went to them. After yesterday, 31/08/2011, updated at 6, when I close the browser after a session, usernames and passwords are gone and must be re-entered. This only happens when I sail as a "standard" user If I surf the web as administrator, all my saved info is still there.

    No worries; Type "subject: config" into your address bar, and you should get an alert guarantee invalidated. I leave the checkmark in the box for warn me next time.

    After you click "I'll be careful", Firefox shows you multiple options, I'm guessing around 1500. Entering 'form' in the filter will only display options containing this string. Options I searched automatically deal with remembering the info you repeatedly enter in web forms.

    Some changes require a reboot, and I'm not hip to that. At least in this case, you will still restart to see if it worked.

    It is also critical that navigating the Windows registry, but the same kind of precautions apply; You can seriously break your stuff here. Just like Windows and the registry, a clean reinstall can fix everything you break here, but it's always a concern that you would avoid instead. Be careful and patient.

    Take notes, which you change the value, so you can change back - right click to copy the name of the option, its value or both, thus facilitating a list of notebook. Remember that you may need to change a couple.

    I am not sure that these options can relieve your frustrations, but this is my last idea in addition to a clean reinstall of Firefox.

  • Hard drive used with reinstalled Vista asks you username and password

    I replaced my hard drive damaged by a second-hand and reinstalled Vista. At the start he is now asking for the user name and password. I have a password on the original hard disk, and it did not start. I tried my old user name with blank password, but it didn't work. How can this be repaired?

    I installed Windows again using the original installation disc of Vista came with the Dell laptop. Installation worked fine, but ask some 'Other' user name and password to the launch of Windows. Tried to my 'old', but would not work.

    So I erased opportunity newly installed using the DBAN program and reinstalled Windows Vista hard drive. That did the trick. I was able to launch Windows and create a new username and password. Once I got into Windows, I've updated the drivers from the Dell website using my Service tag. Work now - great Amen!

  • I get the error 0x800ccc92 with Windows Mail asking for my username and password.

    The username and password I used does not work.  How can I get my username and password or implement new?

    http://www.SimpleHelp.NET/2007/02/07/a-beginners-guide-to-setting-up-Windows-Mail/

    Link above has an easy to follow Guide to set up Windows Mail.

    Contact your ISP (Internet Service Provider).

    They offer your broad band/Dial-up connection.

    Ask them to:

    username
    password for your service account to wide band/Dial-Up with them

    Server of incoming POP3 mail
    outgoing mail SMTP server

    The above information is required to set up Windows Mail.

    ISPS are usually happy to help you set up your email account.

    See you soon.

    Mick Murphy - Microsoft partner

  • I can't connect to my external hard drive to my wireless network, it keeps askin for a username and password that none of my usernames and passwords work, help please

    I'm unable to map to my external hard drive that I use for backup of three computers, the drive is connected to a desktop computer, I'm trying to map the drive on your laptop and it ask again me a network user name and password that I don't have, I tried all of the username and password in my arsenal and none of them work , I did not create my network with a password. can someone help me please.

    Hi CharlesToney-Jones,

    You can follow the steps described in the connection with the similar question:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-Networking/cannot-connect-to-wireless-external-drive/3802350b-AAD9-4980-bead-8ef3a2ef1fea

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-files/what-is-the-most-efficient-way-to-save-software-to/310cc5c2-3cfd-4936-9c2b-3e8b5250a290

  • How can I reset my "authentication required" username and password? The fields are always filled with my old information.

    How can I reset my "authentication required" username and password? The fields are always filled with my old information.

    Follow these steps to delete the recorded data (form) in a drop-down list:

    1. Click on the (empty) input field on the web page to open the drop-down list
    2. Select an entry in the drop-down list
    3. Press the DELETE key (on a Mac: shift + delete) to remove it.
    • Tools > Options > Security: passwords: "saved passwords" > "show passwords".

    You may need to clear cookies from this site, so if you checked a box to remember you.

  • gmail login page always opens with my username and password already filled

    I go to the login page for gmail - little matter how I'm here via a bookmark or not - the page is always displayed with my username and password already filled. Questions (a) is not sure, anyone could sign as me simply by pressing 'back' (b) other users in the House need to back my details away in order to enter their own.

    I tried to reinstall Firefox - no use. How to make a gmail login page to open with empty boxes for username and password?

    Thanks in advance for any advice!

    It seems that your username and passoword are saved in your browser. You cannot remove from tools > Options > Security > saved passwords Panel. Also you can enable/disable this password box do not forget in the same pane.

  • Account - My Windows email account to login with a username and password of e-mail

    I had this same problem about 2 years ago... my windows email account wants to connect with a user name and password. Why? It's been so long, I don't know what they were... I don't want this problem with my email... ever... How can I avoid this.    I just created a different password so I could do... How can I get my email again?  I won't be able to see your response as my email is broken.  You can call me * removed *. Thanks lj

    If you have forgotten your username and password, you will need to contact your email provider and get this information from them.  At the same time, they can tell you the right settings for your e-mail program, you specify here, so it is difficult to proceed further in your question.  You can check here: www.oehelp.com/OETips.aspx#3

    Steve

Maybe you are looking for