×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    5

    connecting to a servlet from a midlet using an http connection

    Hi every body,
    i have a very serious problem here, i use http connections to call a servlet from a midlet and it works just fine on the emulator. i deployed the midlet and when i run it it requests to select the access point for the connection, so, i choose 'vodafone WAP', the problem is, this is what i get:

    <?xml version='1.0' ?><!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.0// EN"http://www.wapforum.org/DTD/xhtml-mob

    by the way i use j2me, nokia 6630, my network operator is 'vodafone' and this is the code i use to open the http connection:

    StringBuffer buffer;
    try {
    StreamConnection connection = (StreamConnection) Connector.open("http://10.1.33.5:8084/Web_Tier/MobHttpTransceiver");

    InputStream in = connection.openInputStream();
    buffer = new StringBuffer();

    int ch;
    while (( ch = in.read()) != -1)
    {
    if (ch != '\n')
    buffer.append((char) ch);

    else{
    }
    get_textBox1().setString(buffer.toString());
    }

    } catch (Exception ex) {
    //get_textBox1().setString("exception: "+ex.getClass());
    }

    any one who can help ?!

  2. #2
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Hamburg, Germany
    Posts
    281

    Re: connecting to a servlet from a midlet using an http connection

    I guess that the server with the name http://10.1.33.5:8084 ist just not visible from the internet. Your phone use the vodaphone gateway, which is located at vodafone, to access the internet. It has no chance to access your local network or your PC.

    If this is not the problem, uncomment the following line:

    } catch (Exception ex) {
    //get_textBox1().setString("exception: "+ex.getClass());
    }

    and tell us what exception you get.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    5

    Exclamation Re: connecting to a servlet from a midlet using an http connection

    Hi,
    thank u for the fase reply.
    the exception is 'java.lang.IllegalArgumentException', but, what is this xml document any way? and why it comes out although my server is visible through the internet? is it a configuration problem?
    thanks in advance,

Similar Threads

  1. Close HTTP Connection bug ???
    By cars2004 in forum Mobile Java General
    Replies: 11
    Last Post: 2006-08-26, 01:35
  2. HTTP Connection issue
    By akhilss in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2005-09-12, 19:31
  3. killing http connection
    By mshita in forum Mobile Java General
    Replies: 3
    Last Post: 2005-02-28, 07:49
  4. http connection from 7650
    By sujoydas in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2003-09-30, 11:10
  5. 7650 Http Connection Works! Source Code Example
    By sjwilks in forum Mobile Java General
    Replies: 3
    Last Post: 2003-02-10, 14:50

Posting Permissions

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