×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    Hello Nokia Support,

    ### This issue is very important for me, since the project I'm working on is part of my Ph.D. thesis. So please answer ###

    I have already posted some messages accodind to this issue but it seems that I can provide much more information in order to understand my problem.

    After I have successfully trasmitted data using the HttpConnection's POST method, I just want to read the response code in order to see if the request was successful or not.

    Whenever I call HttpConnection.getResponseCode() or HttpConnection.getResponseMessage() my phones throw an IOException. The Error Message is "Http-version mismatch". This error occurs on both phones:

    Nokia 3650 firmware version 3.12
    Nokia 7650 firmware version 4.46

    I have tested the connection with gprs and normal data connection. Both resulting in the error message mentioned above.

    On the Emulator the code works fine.

    Thanks for help and a quick reply,

    Best regards, Michael Kroll.

    Co-Author of the SAMS book "J2ME Application Development" and
    Markt+Technik "Java 2 Micro Edition Developer's Guide"

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    17
    ....I forgot to mention that the server is a Tomcat v 4.1.24 HTTP1.1. Perhaps there is a bug in the HTTP1.1 communication?

    Thanks.

    Michael Kroll.

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Tampere / Finland
    Posts
    201
    Hello,

    What's your default language of the phone? In some old firmware S60 phones, if you are not using English (for example Finnish), "HTTP 1.1" is converted to "HTTP 1,1" when the header is send.

    Regards,

    Kui

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    17
    The default languange of my phones is German.
    But I tried it with english as well, without luck.

    BTW, the firmware on both phones isn't old, but the latest available.

    Regards, Michael Kroll.

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Exclamation Re: HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    Hi, I have the same error:

    "java.io.IOException: HTTP-Version Mismatch"

    I am using Nokia N97
    The phone was bought in Italy, but I set the language to English, is there a difference between set language and default language of OS ?

    I run my app. in emulator of N97 and it works ok.

    My Code is (I took an example from nokia website and bit simplified it)
    String getDataFromServer(){
    String serverUrl = new String("http://www.google.com");
    HttpConnection httpConn = null;
    InputStream is = null;
    String dataRead = "";
    try{
    httpConn = (HttpConnection)Connector.open(serverUrl);

    // if((httpConn.getResponseCode() == HttpConnection.HTTP_OK)){
    form.append(String.valueOf(HttpConnection.HTTP_VERSION));
    int length = (int)httpConn.getLength();
    is = httpConn.openInputStream();
    int chunkSize = 1500;

    } catch(Exception e){
    System.out.println("Exception occurred during GET "+e.toString());
    form.deleteAll();
    form.append("\nNetwork failure in retrieving data from " +
    "server. Try Again!\n");
    form.append(e.toString());
    form.append(e.getMessage());
    Display display = getDisplay();
    display.setCurrent(form);
    }

    return dataRead;
    }

    Output on display:
    Network failure..... Again!
    java.io.IOException: HTTP-Version Mismatch
    HTTP-Version Mismatch

    Thx, for quick reply
    All the best
    Michal Doubek

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    Try this:

    PHP Code:
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class 
    HttpReader extends MIDlet implements CommandListenerRunnable {

        private static final 
    Command cmdGET  = new Command("GET"Command.SCREEN1);
        private static final 
    Command cmdEXIT = new Command("Exit"Command.EXIT, 1);

        private static final 
    String DOCUMENT_URL "http://www.google.com/";

        private 
    Form frm;
        private 
    StringItem status;
        
        public 
    void startApp() {
            
    Display disp Display.getDisplay(this);

            
    frm = new Form("HttpReader");
            
    frm.addCommand(cmdEXIT);
            
    frm.addCommand(cmdGET);
            
    frm.setCommandListener(this);

            
    status = new StringItem(null"Ready");
            
    frm.append(status);

            
    disp.setCurrent(frm);
        }

        public 
    void pauseApp() {
        }

        public 
    void destroyApp(boolean unconditional) {
        }

        private 
    void setStatus(String s) {
            
    status.setText(s);
        }

        
    // implementation: CommandListener
        
        
    public void commandAction(Command cmdDisplayable disp) {
            if (
    cmd == cmdEXIT) {
                
    destroyApp(false);
                
    notifyDestroyed();
            } else if (
    cmd == cmdGET) {
                
    frm.removeCommand(cmdGET);
                
    frm.removeCommand(cmdEXIT);
                
                (new 
    Thread(this)).start();
            }
        }

        
    // implementation: Runnable

        
    public void run() {
            try {
                
    setStatus("Connecting...");
                
    HttpConnection httpc = (HttpConnectionConnector.open(DOCUMENT_URL);

                try {
                    
    httpc.setRequestMethod(HttpConnection.GET);
                    
    int code httpc.getResponseCode();
                    if (
    code != HttpConnection.HTTP_OK) {
                        throw new 
    Exception("HTTP code: " code);
                    }
                    
    String type httpc.getType();
                    
    int length = (int) httpc.getLength();

                    if (
    length >= 0) {
                        
    byte[] ao = new byte[length];
                        
    DataInputStream din httpc.openDataInputStream();
                        try {
                            
    din.readFully(ao);
                        } 
    finally {
                            
    din.close();
                        }

                        if (
    type.startsWith("text/")) {
                            
    frm.append(new String(ao));
                        } else if (
    type.startsWith("image/")) {
                            
    frm.append(Image.createImage(ao0length));
                        } else {
                            
    frm.append("Can't handle type: " type);
                        }
                    } else {
                        
    setStatus("no length");
                    }
                } 
    finally {
                    
    httpc.close();
                }
                
    setStatus("Complete.");
            } catch (
    Exception e) {
                
    setStatus("Error: " e);
            } 
    finally {
                
    frm.addCommand(cmdEXIT);
            }
        }

    Graham.

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Re: HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    So I've got this problem solved, I brought it to "Nokia Care Point" and for a just "formal fee" of 30 EUR, I got the firmware reinstalled. Now I have firmware for UK and it works perfectly. Before I had Italian.

  8. #8
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    65

    Re: HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    Hi Guys

    I am also facing the same issue with my old Nokia E61 device.

    Has anybody solved the issue without updating the software or changing the server side code.

    What i mean is -- Is it possible to solve this issue programmatically ?

    Thanks
    Early reply appreciated !

    Pradeep

    Quote Originally Posted by mkroll View Post
    Hello Nokia Support,

    ### This issue is very important for me, since the project I'm working on is part of my Ph.D. thesis. So please answer ###

    I have already posted some messages accodind to this issue but it seems that I can provide much more information in order to understand my problem.

    After I have successfully trasmitted data using the HttpConnection's POST method, I just want to read the response code in order to see if the request was successful or not.

    Whenever I call HttpConnection.getResponseCode() or HttpConnection.getResponseMessage() my phones throw an IOException. The Error Message is "Http-version mismatch". This error occurs on both phones:

    Nokia 3650 firmware version 3.12
    Nokia 7650 firmware version 4.46

    I have tested the connection with gprs and normal data connection. Both resulting in the error message mentioned above.

    On the Emulator the code works fine.

    Thanks for help and a quick reply,

    Best regards, Michael Kroll.

    Co-Author of the SAMS book "J2ME Application Development" and
    Markt+Technik "Java 2 Micro Edition Developer's Guide"
    Thanks and Regrads
    Pradeepcg

  9. #9
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    Quote Originally Posted by mkroll View Post

    Whenever I call HttpConnection.getResponseCode() or HttpConnection.getResponseMessage() my phones throw an IOException. The Error Message is "Http-version mismatch". This error occurs on both phones:
    Well that an interesting thing to know...
    Would like to know that where exactly are you trying to get the response code and message in the code?

    I will appreciate if you could put the Code?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  10. #10
    Registered User
    Join Date
    May 2011
    Posts
    1

    Re: HttpConnection getResponseCode() Error on 3650 and 7650 "Http-version mismatch"

    hello NOKIA SUPPORT,
    HI,, i am engineering student from Goa.i need some help in my academic project.i have created my server application and have hosted it using tomcat server and i have also hosted my MYSQL database online.but i dont know how to access that remote database from my gprs enabled mobile phone....Can anyone please help me with this??I HAVE JUST ABOUT A MONTH LEFT WITH ME....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •