Encoding of the Http blackBerry connection issue

Dear,

I have connected using the http url:

QUrl mRequestParams = QUrl(url);

    QNetworkAccessManager *networkManager = new QNetworkAccessManager(this);
    QUrl requestUrl(url);

    QNetworkRequest request(requestUrl);
    request.setHeader(QNetworkRequest::ContentTypeHeader,
            "application/x-www-form-urlencoded");

    if (networkManager) {

        bool resFromServer = connect(networkManager,
                SIGNAL(finished(QNetworkReply*)), this,
                SLOT(requestFinished(QNetworkReply*)));

        qDebug() << "Connection is success : ? : " << resFromServer;

        Q_ASSERT (resFromServer);
        Q_UNUSED(resFromServer);

        QNetworkReply *reply = networkManager->post(request,
                mRequestParams.encodedQuery());
        if (reply) {
            qDebug() << "Reply from server is " << reply;
        }
    }
   /*!
     * @brief QString object to be used to store server response
     */
    QString response;

    if (reply) {
        if (reply->error() == QNetworkReply::NoError) {
            int available = reply->bytesAvailable();
            if (available > 0) {
                QByteArray buffer(reply->readAll());
                response = QString(buffer);
            } else
                response = "Zero bytes in response";

        } else {
            int httpStatus = reply->attribute(
                    QNetworkRequest::HttpStatusCodeAttribute).toInt();
            response =
                    "Error and the code is "
                            + reply->attribute(
                                    QNetworkRequest::HttpStatusCodeAttribute).toString()
                            + "  And the Error string is :: "
                            + reply->errorString() + "\n";
        }
        reply->deleteLater();
    } else {
        response = "Response comes out to be null";
    }

    if ((response.trimmed().isEmpty())) {
        response = "Empty Response";
    }
    qDebug() << "Response String is :: " << response << " \n";

    if (!response.isNull()) {
        // You got response . Do whatever you want to do with it.
        QTextCodec *codec = QTextCodec::codecForName("UTF-8");
        QByteArray encodedString = codec->fromUnicode(response);

        parseXml(encodedString);
    }
void ListChannelModel::parseXml(QByteArray xmlByte) {

    /* QXmlStreamReader takes any QIODevice. */
    QXmlStreamReader xml(xmlByte);

    if (xml.hasError()) {
        qDebug() << "XML error: " << xml.errorString() << endl;

    } else {

        XmlDataAccess xda;
        QVariant list = xda.loadFromBuffer(xmlByte, "channels/channel");

        ArrayDataModel *dataModel = new ArrayDataModel();

        dataModel->append(list.value());

        emit dataLoadedSignal(dataModel);
    }

After I have load data in the view of the list that I'm dealing with coding error

check the image

Can you help me?

Have you tried to use the QString::fromUtf8 method?

Tags: BlackBerry Developers

Similar Questions

  • Internet - unable to connect to the proxy serer connection issues

    I have two problems, which could well be related.  Equipped with Vista.  Firefox running, all of a sudden a site using java wouldn't work.  I tried the automatic installation of Java, it has failed.  I tried the manual installation and said "Setup cannot continue with the current internet connection settings" (which is not one of the error messages shown on the help that is aimed at page).

    I decided to try to do it through IE.  It is not connect to the web at all (not Opera).  When I tried the link diagnose, I think once it says "unable to connect to the proxy server" well this time he said www.google.com is not set up to establish a connection on the port world wide web (http) service on this computer.

    Can you help me with, or ideally for both - if they are not conneccted - problem.  Thank you.

    Hello
    Let me assure you that I am on the same page here.
    1. you can get online via Firefox, but not with any other browser?
    What happens if you try to connect without a browser... just use the connection to connect before you open a browser?
    Was there anything added/removed before it began?
    Have you run an anti-virus and anti-malware scans?

    Also try:
    http://support.Microsoft.com/kb/937151
    http://Windows.Microsoft.com/en-us/Windows-Vista/change-proxy-settings-in-Internet-Explorer
    hope this helps,
    B Eddie

  • why only the https addresses connect on Windows XP?

    On my desktop running Windows XP Firefox will connect to https sites - why?
    My question is sent to a netbook.

    Large. Very glad to hear it.

    Thanks for letting me know.

  • Hi my game Center leaves me not to accept friend requests, load any games im unable to load data because of connectivity issues and the King Games I have when you want to send queries, you need to connect whenever fbk his shit

    Hi my game Center won't let me load any games or accept friend requests and when I try to accept queries etc. of friends on my King of games it's connect to facebook every time his shit. phone says on the game center connectivity issues I am not worked before

    Hi, kitecatgirl.

    Please visit Apple support communities.

    I understand that you experience connectivity problems when you access Game Center accepting friend requests.  Here are some troubleshooting steps that I recommend to go through this problem.

    Get help

    If you are unable to connect to Game Center or stay connected, follow these steps:

    1. Make sure that you are connected to the Internet.
    2. If you cannot create an account or sign in to Game Center of in a game, try to create an account or sign in with the Game Center app.
    3. Sign out of Game Center, then reconnect. If you can not you connect to Game Center with an Apple ID, reset your password, or use another email address. To manage your Apple ID, see my Apple ID.
    4. If you use a connection Wi - Fi, be sure that your Wi-Fi router is configured for Game Center.
    5. If you can't connect to a Mac, continue with the steps to solve the sign in questions.

    If you have a problem with a game of Game Center, follow these steps:

    1. Make sure you have the latest version of the game. To check for updates, go to App Store > updates.
    2. Test your connection by using a different game. If you cannot connect with a specific friend or player in multiple games, they might need to check their Wi - Fi connection and router settings.
    3. On iOS, try opening the game to the home screen, rather than the inside Game Center.
    4. If you cannot resolve the problem, follow the steps described in the next section to report the problem to the developer.

    Game Center on your Mac or iOS device using

    See you soon

  • Database MS SQL Server with AIX server connectivity issues

    Hi all

    I am confronted with the below with the AIX server connectivity issues.

    Operating system: AIX 64 bit

    DB: SQL Server 2005

    EPM Version: Hyperion 11.1.1.4

    Error creating socket to host and port 1433. Reason: Connection timed out: could be due to an invalid address

    Tired of Solution

    (1) checked the properties of TCP/IP, its permitted.

    (2) ping the source and target servers both ends all works fine

    (3) firewall is DISABLED in DB Server

    Hi all

    My apologies, its number of firewall & network. Resolved by the Unix administrator.

    Thank you

  • http in the 3g blackberry 7.0 network connection problem (verzion &amp; AT &amp; T)

    Hello

    I developed an application for 4.6 and later, in I get "java.io.IOException: a service book entry not found for IPPP" error network 3g blacbkerry 7.0, but it usually occurs in 6.0 3 g. below, I pasted my code can you please tell me what is the problem in my code.

    * DELETED URLS *.

    Note: And also I tried peters HttpLibrary example of a forum, but no use.

    Thanks in advance,

    PAPI. M

    My sample is only really useful if you access BIS-B.  That said I think that logging in the code is much better than most of the other examples I've seen...

    Thin I the problem here is that your code is to choose a suffix of bad connection.  Can you tell us what your code has actually chosen?  I bet it's based on a service record the 'rubbers '.

    The code that you have based it looks like it wasn't initially provided RIM, I've never seen RIM code use 'bib '.  If you want to code the rim that will help you determine the types of transportation available and you give the correct URL connection string to use this, so I recommend this article:

    http://supportforums.BlackBerry.com/T5/Java-development/what-is-network-API-alternative-for-legacy-O...

    I'll try to work the KB code provided in the code that you already have.

    Also it can be useful to print the records of the device which is a failure and knitting that your code and choose which code KB for the suffix of the connection.

    And one last thing, I recommend that you choose BES/MDS first so if it is available.

  • Problem in the http connection. (simulators 5.0 os blackberry 9000 smartphone)

    Hello friends,

    I am doing my project in Eclipse Platform Version: 3.4.1 4.5 os and I'm using the 8300 Simulator. I use the http connection. When I debug my project, I work correctly. I'm download 8300 same Simulator to test the object. It worked correctly in Simulator 8300.

    but when I try 4.7 and 5.0 for Simulator that I download this Simulator my project does not work correctly the problem of http connection. Someone tell where I'm wrong?

    Thank you

    Ajay.

    also to install BlackBerry JDE 5.0.

  • Errror: The certificate chain was issued by an authority that is not approved. connecting to a wireless access point

    I can't understand the process of certificates, by connecting a pc wireless access point that is authenticated by the radius server, im keep having this error "the certificate chain was issued by an authority that is not approved." do I need to set a certificate on the pc?

    Hello

    1. What is the version of the operating system that you are using?

    2. What is the exact full error message?

    If you use Windows 7 follow the link below:

    http://Windows.Microsoft.com/en-us/Windows7/view-or-manage-your-certificates

    http://Windows.Microsoft.com/en-us/Windows7/certificates-frequently-asked-questions

    You can also contact your ISP for more information.

    Hope the above information is helpful.

  • cannot reduce the application on end key click on the http connection.

    Hi all

    I use version eclipse3.4 for Blackberry development. In my application, I need to extract data from a Web service via a servlet created by me. I've implemented it using a wire and it works fine.

    But the problem is, after the http connection, when control passes to servlet I can't minimize my application using events end key as a normal application. This fine event key only works when the control back on the side of the unit... My entire application got stuck when he tries to retrieve the data from webservice... Please help me on this.

    Please guide me how to implement the reduction feature in my application when it attempts to retrieve data from the server using the http connection.

    I used this package for connecting

     

    javax.microedition.io.Connector; javax.microedition.io.HttpConnection;

    Please help me on this...

    Advanced thanks and greetings,

    Michel Philippe.

    You will need to run the web service code in a separate thread...

  • Connectivity issues while trying to connect in spades to MSN on the computer

    * Original title: msn Spades - he works?

    I can't log on to msn Spades; something about connectivity issues; can someone help here?

    Hi Steve-Bob,

    Thanks for posting your question in the Microsoft Community Forums. I'm sorry to hear that you are facing connectivity problems while trying to connect in spades to MSN on the computer.

    I imagine the inconvenience that you are experiencing. I will definitely help you with this.

    I would like more information about the issue.

    1. What is the exact error message?

    2. what browser you're using connection?

    3 have there been recent changes made on the computer before the show?

     

     

    If you are using internet explorer, please follow these methods and check if it helps.

    Method 1: Verify the problem by running Internet Explorer mode without modules.

    Temporarily disable all add-ons to see if the modules are the origin of the problem.

    To temporarily disable all add-ons:

    a. click the Start button.

    b. click on all programs, accessories, and click on system tools.

    c. click on Internet Explorer (No Add-ons).

    If the Internet Explorer (No Add-ons) mode works very well then an add-on may be causing the problem. You will need to re-enable each (process of elimination) in order to determine which one is causing the problem.

    http://Windows.Microsoft.com/en-us/Windows7/Internet-Explorer-Add-ons-frequently-asked-questions

     

     

    Method 2: Optimize Internet Explorer and check.

     

    How to optimize Internet Explorer

    http://support.Microsoft.com/kb/936213/no

     

    Warning: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.

     

    For more information, visit the following link.

    Sign in using

    http://zone.MSN.com/en/support/article/supporthubsignin

     

     

    If the problem persists, feel free to let us know. It is our pleasure to be of service.

  • Nighthawk 7000 activate https / ssl connection to the internal administration

    Dear community,

    I want to change the administration page to browser http to https (port 443). The only thing I found is the ability to open https for external administration.

    I want to stop sending the admin to the router plaintext password in my home network. Is it possible to configure https for administration?

    If there is no safe way for the router configuration using wlan how to configure you there safely (with the direct help of cable attached to the router)?

    Best regards

    Mark

    As far as I KNOW, there is no way to activate https for internal administration. The assumption is that you have a reasonable control over devices in your network.

    The way only I can think of to manage your router must turn off the radio by using the physical button on the Wi - Fi connection and disconnect all devices wired the R7000 except for a wired computer.

  • My computer says that it is connected to the internet but the HTTP 500 Internal server Err error rises. How I get working again?

    Why my internet has stopped working

    My computer says that it is connected to the internet but the HTTP 500 Internal server Err error rises. How I get working again? I have another computer in the House and that works very well.

    http://support.Microsoft.com/kb/321448

    In some cases, you must remove the cookie as well.
  • The G7 Pavilion Internet connectivity issues

    Help! I'm working on a laptop for a consumer, and I'm stuck hard. The laptop is a G7 Pavilion with Windows 7 64 bit. The machine was given to me under the principle of "The Internet does not work". Properties with wireless and LAN settings say that the laptop is connected and it has Internet access. I can ping outside the machine address and can ping the machine from other devices. It is also a valid ip address according to an ipconfig. However, when you try to pull on a Web site, there is a page "Web site is not found." This happens on IE, Firefox and Chrome. All drivers ethernet drivers, chipset and wireless drivers were uninstalled and reinstalled. They are the latest drivers available on HP website. I even replaced the wireless NIC thinking it's maybe just a bad card. I checked the IPv4 settings and all is good. Think to any DNS problems, I tried using directly the IP to connect to Web pages, but all without success. I'm quite baffled and need advice. Is there BIOS problems that adversely affect this? Any suggestion would be appreciated.

    Hey Darken_Rahl,

    Hmmmmmmm... interesting.

    Are you able to ping to an IP address?

    I don't think that you are dealing with a hardware problem, it must be the establishment / OS related.

    This really looks like a DNS issue even if IP navigation does not work. You have emptied the DNS? If this isn't the case, please do so now:

    1. Press Windows Key + R.
    2. Type cmd , and then click OK.
    3. Type ipconfig/flushdns and press on enter.
    4. Test.

    Also try these in an elevated command prompt:

    1. Start.
    2. Type cmd in the search.
    3. Right click on cmd/prompt commands and run as administrator.
    4. Type netsh I I r r and press ENTER.
    5. Type netsh winsock reset , and press ENTER.
    6. Restart.
    7. Test.

    Let me know the results of those.

  • GetResponseCode of the HTTP connection failed? :(

    Hey all,.

    I am fairly new to the development of BB.  I'm trying to get my application to connect to the web and pull down some data.  I think I'm close, but after using the debugger and stepping through my code, I noticed it stops at the ' rc = c.getResponseCode (); "subscribed line.  (Stops, I mean it running... it doesn't give any errors, but he never stepped on the next line... everythign is right there...)

    What Miss me?

    System.out.println(">>> in new threads run");
                    try {
                        HttpConnection c = null;
                        InputStream is = null;
                        int rc;
    
                        try {
                            System.out.println(">>> in new threads try");
                            c = (HttpConnection)Connector.open("http://www.google.ca");
                            System.out.println(">>> c : "+c);
                            // Getting the response code will open the connection,
                            // send the request, and read the HTTP response headers.
                            // The headers are stored until requested.
                            rc = c.getResponseCode();
                            System.out.println(">>> rc : "+rc);
                            //testing(rc);
                            //String ryan = Integer.toString(rc);
                            //Bitmap icon = Bitmap.getBitmapResource("img/download.png");
                            //statusDlg = new Dialog(ryan,null,null,0,icon);
                            //statusDlg.show();
                            if (rc != HttpConnection.HTTP_OK) {
                                throw new IOException("HTTP response code: " + rc);
                            }
    
                            is = c.openInputStream();
                            System.out.println(">>> is : "+is);
    
                            // Get the ContentType
                            String type = c.getType();
                            System.out.println(">>> type : "+type);
    
                            // Get the length and process the data
                            int len = (int)c.getLength();
                            System.out.println(">>> len : "+len);
                            if (len > 0) {
                                int actual = 0;
                                int bytesread = 0 ;
                                byte[] data = new byte[len];
                                while ((bytesread != len) && (actual != -1)) {
                                    actual = is.read(data, bytesread, len - bytesread);
                                    bytesread += actual;
                                }
                            } else {
                                int ch;
                                while ((ch = is.read()) != -1) {
    
                                }
                            }
                        } catch (ClassCastException e) {
                            System.out.println(">>> WTF : "+e);
                            throw new IllegalArgumentException("Not an HTTP URL");
                        } finally {
                            System.out.println(">>> WTF2");
                            if (is != null)
                                is.close();
                            if (c != null)
                                c.close();
                        }
                    } catch (IOException e) {
                    } catch (Exception e)
                    {
                        e.printStackTrace();
                    }
    

    He may be waiting the connection end. Network connection attempts take awhile to timeout - the order of minutes. If you are debugging in the Simulator, you shot above the MDS Simulator? If a device is connected?

    You can also take a look at the CoverageInfo class as a way to check the availability of connection before you actually start a connection.

  • How to get the gif file hosted by using the Http connection?

    Hello

    I have an application that downloads animation gif from a server by using the http connection. Here is the code I use to download the image.

    try {
    
                httpConnection = (HttpConnection) Connector.open(url, Connector.READ_WRITE);            httpConnection.setRequestMethod(HttpConnection.GET);
    
                if (httpConnection.getResponseCode() == HttpConnection.HTTP_OK) {                DataInputStream dS = httpConnection.openDataInputStream();
    
                    byte[] data = new byte[dS.available()];                dS.read(data);
    
                    gifImage = (GIFEncodedImage) EncodedImage.createEncodedImage(data, 0,data.length);
    
                } else {                throw new Exception("ResponseCode:" + httpConnection.getResponseCode());            }        } catch (Exception e) {                        gifImage = null;            e.printStackTrace();        }
    

    the problem with this code is, when the gif file is 1175 bytes above, it does not load the gif.

    example:-If the gif on the server is 1500 bytes, this code retrieves only 1175 bytes.

    I think that the rest of the bytes are sent in a different package. But how to get them.

    can someone please provide a code for buffering the inputstream?

    any help is appreciated.

    Dieye

    Hmm, nobody seems to know how to do, it seems. Here's how I did it.

                httpConnection = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
                httpConnection.setRequestMethod(HttpConnection.GET);
    
                int responseCode = httpConnection.getResponseCode();
                if (responseCode == HttpConnection.HTTP_OK) {
                    inputStream = httpConnection.openInputStream();
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    
                    byte[] buffer = new byte[256];
                    int len = 0, imageSize = 0;
    
                    while (-1 != (len = inputStream.read(buffer))) {
                        byteArrayOutputStream.write(buffer);
                        imageSize += len;
                    }
    
                    byteArrayOutputStream.flush();
                    byte[] imageData = byteArrayOutputStream.toByteArray();
                    byteArrayOutputStream.close();
    
                    gifImage = (GIFEncodedImage) EncodedImage.createEncodedImage(imageData, 0, imageSize);
    

Maybe you are looking for

  • Y at - it a program that will help me to document all my bills and receivables for my CFO

    I am the owner of a small business (1 person) trying to prepare all my bills - account numbers, web sites and access to invoices, the dates due, how bills are paid - and my debts for a new CFO, so it can take over the management of my company, pay my

  • Audio drivers T42 2373 (XP)

    Hello I need to find the correct audio drivers for this baby. The Lenovo provided a (1ga241ww.exe) does not work - it does not recognize the audio material. The device in question seems to be a multimedia audio controller, Code provider 8086, dev id

  • can see is more jpg / gif in the Windows Photo Gallery

    Hello. Windows Photo Gallery, internet explore and windows Explorer no longer open photos as they did. Windows Photo Gallery gives this error when you open a jpg or gif file."" Cannot open Photo theis photo gallery or video. The file appears to be da

  • ALT tab the Oops!

    I accidentally hit alt and tab and now have a huge blue box and an announcement on my desk.  How should I do?

  • WARNING! : no definition not found for static exported routine: .main (String [])

    Hello world In the JDE, I opened two different projects in the workspace of "samples" where all demonstration projects. One of my apps built correctly, also it is open in the Simulator and runs smoothly. But in the same way, when I try to build and r