×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    2

    Unhappy Java / HttpConnection error on 6230i

    Hello,

    I am stuck with the same problem for a couple of days - I did a fair amount of reading on this forums and others, but it seems I just can't solve it.

    I am trying to get a web page (text) from a web server with my 6230i. I works with the emulator, but when I run it on the device, I get a IOException error : Error in HTTP Operation.

    What I did (and didn't change a thing) :
    - start the connection in a different thread
    - change POST to GET
    - add and remove various headers
    - add sleep time at various locations

    And of course I can connect and view the page using the embedded web browser. Apparently the access point is the provider's WAP gateway.

    Please help, I'm running out of ideas.

    Thanks,

    Alex

    //code :

    DataInputStream dis = null;
    DataOutputStream dos = null;
    StringBuffer responseMessage = new StringBuffer();
    String response = null;
    HttpConnection hcon = null;

    try {


    hcon = ( HttpConnection )Connector.open( testUrl, Connector.READ_WRITE );

    hcon.setRequestMethod( HttpConnection.GET );

    if (hcon.getResponseCode() == HttpConnection.HTTP_OK) {
    dis = hcon.openDataInputStream();

    // Get the length and process the data
    int len = (int) hcon.getLength();
    if (len > 0) {
    byte[] chars = new byte[len];
    int actual = dis.read(chars);
    response = new String(chars);
    //process(data);
    } else {
    int ch;
    while ((ch = dis.read()) != -1) {
    responseMessage.append( (char)ch );
    }
    if (responseMessage.length() > 0) {
    response = responseMessage.toString();
    }
    }
    }
    }
    catch( IOException e ) {
    write(e.toString());

    }
    finally {
    // free up i/o streams and http connection
    try {
    if( hcon != null ) hcon.close();
    if( dis != null ) dis.close();
    if( dos != null ) dos.close();
    } catch ( IOException ioe ) {
    ioe.printStackTrace();
    }//end try/catch
    }//end try/catch/finally

  2. #2
    Registered User
    Join Date
    Sep 2005
    Posts
    2

    Smile Re: Java / HttpConnection error on 6230i

    Well, it's kind of fixed.
    I call my provider (Bouygues Télécom, France) to check my services, and it appeared that the "multimedia" service (internet from your phone) doesn't allow "data" transfer. So I subscribed to the "data" service, and... it works.

    Both seem to go through the same WAP gateway though.

    I'm not very happy to have wasted so much time on that, but I'm glad nobody answered this post - my shame is lessened...

    Alex

Similar Threads

  1. 6230i MMAPI play java?
    By yonan32 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2006-08-09, 09:57
  2. Bug with instaling java applications on Nokia 6230i
    By _DENgerous_ in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2005-09-21, 14:58
  3. Memory space for Java apps. on 6230i
    By CallCenterAgent in forum Mobile Java General
    Replies: 3
    Last Post: 2005-07-12, 14:13
  4. How develop Java games on mobile phones?
    By ericzutter in forum Mobile Java General
    Replies: 4
    Last Post: 2003-11-20, 23:14
  5. Audio Capture in Java
    By larrydb in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2003-08-25, 15:13

Posting Permissions

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