You Are Here:

Community: Developer Discussion Boards

#1 Old 7650 Http Request/Response Issue - 2003-05-12, 18:42

Join Date: May 2003
Posts: 1
squeeky2k
Offline
Registered User
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();
}
Reply With Quote

#2 Old 2003-05-13, 14:02

Join Date: May 2003
Posts: 5
nooro
Offline
Registered User
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 15:11.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia