×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    9

    HttpConnection problem

    Hi all,

    I have a problem to enstablish a connection over http on my servlet.

    This is my code:
    conn = (HttpConnection)Connector.open("http://192.168.10.35/jabber/jabber", Connector.READ_WRITE);
    conn.setRequestMethod( HttpConnection.POST );
    conn.setRequestProperty( "User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0" );
    conn.setRequestProperty( "Content-Language", "en-US" );
    //conn.setRequestProperty( "Connection", "Keep-Alive" );
    conn.setRequestProperty( "Connection", "close" );
    conn.setRequestProperty( "Accept", "application/octet-stream" );

    but conn.getResponseCode(); return error code 500.
    we you have any idea???

    Ciao Alessio.

  2. #2
    Registered User
    Join Date
    May 2003
    Location
    Portugal
    Posts
    9
    Alessio,

    error 500 is usualy an internal server error caused by compilation or execution error(s) within the servlet code.
    Try to access to http://192.168.10.35/jabber/jabber with a regular browser to see if if it works.

    Best Regards

    nmfelix

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    9
    nmfelix,

    I have found the server exception in readUTF .
    I suppose write-read UTF don't work fine.

    I have changed to
    while((ch=in.read())!=-1))
    and reasponseCode are 200.

    Now, my midlet recive the response of my Servlet but the servlet recive only one character "?" why ??? is a mistake for a moment.

    I write to the servlet in this way
    byte[] b = "Ciao Servlet".getBytes();
    out.write(b)

    no Exception chacked

    ask we have any idea???

    Ciao, Alessio

Posting Permissions

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