×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    1

    7650 Http Request/Response Issue

    I'm having trouble getting a 7650 device to read responses from a server. I've written a MIDlet which posts xml to the server, and attempts to read an xml response. This works fine with the j2me wtk emulator, and on a palm device. However, when the midlet is deployed to the 7650, the server response seems almost nonexistant. HTTP code 200 is almost always returned from the post section, so I can assume this works correctly. I can also verify this from the server side. However following that, the conn.getLength() method returns -1, and the failover clause returns -1 on an attempt to read from the connection.

    Anyone have any ideas? I notice a few posts regarding http specific issues with the 7650 on this forum, is it known to be problematic?? The phone in question is running firmware version 4.37.

    The code I'm using to read the server response is as follows, it's pretty simple :

    if (responseCode==200) {
    in = new InputStreamReader(conn.openInputStream());
    char temp;
    responseLength = conn.getLength();
    if (responseLength > 0) {
    for (int i=0; i<responseLength; i++) {
    temp = (char)in.read();
    if (temp !='\n') {serverResponse += temp;} // don't want line breaks
    }
    }
    else {
    if ((temp = (char)in.read()) != -1) {
    if (temp!='\n') {serverResponse += temp;}
    }
    }
    in.close();
    }

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    5
    After a little fiddling, I've discovered the problem I'm having isn't in the code to read off the response, as I'm getting an IOException way before then that I hadn't noticed (with a message of Status = -20019). On a call to OutputStreamWriter.Close() I can't get that to close successfully, obviously this precludes any further activity on the HttpConnection object, so if that error is handled away (ignored), I get errors later on to the tune of "unexpected end of stream" etc. This happens on both the phone (7650), and series 60 emulator, but works fine on the wtk emulator and a palm based phone - must be something to do with the nokia http/io implementation?!?

    Does anyone have any ideas? I'm really tearing my hair out now.

    (squeeky2k was a colleagues account btw ^_^)
    Last edited by nooro; 2003-05-13 at 14:11.

Posting Permissions

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