Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with HttpConnection

 
Alex Dean
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to go all technical, but I'm having real probs. with the Motorola J2ME's HttpConnection code (on a dial-up connection, if that's relevant). I'm writing a program which sends data to be processed by a Web-based CGI script. Basically, my program hangs when the HttpConnection is asked to switch from the Setup stage to the Connected stage - let me explain:
HttpConnection c = (HttpConnection)Connector.open(queryURL);
c.setRequestMethod(HttpConnection.POST);
// Code makes it here.
is = c.openInputStream();
// Code doesn't reach here.
There's no feedback like exceptions to the console, and according to my "Connected To ..." Windows dialog box, no bytes have been sent out by my computer. I'm at a loss - even setting queryURL to something like "http://www.yahoo.com" (and removing the POST command) doesn't work. Is J2ME's HTTP connection code broken? Am I being really stupid? Is there some networking config. file I need to edit or configure?
 
Eric Giguere
Ranch Hand
Posts: 170
 
Alex Dean
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep,
It's a Motorola-specific problem. The HttpConnection.POST should have been HttpConnection.GET, but then it worked fine with Sun's J2ME Wireless Toolkit. Either Motorola's code is buggy, or the SDK doesn't like being wired into Java 2 JDK 1.3 (it's meant to use 1.2, I think).
Incidentally, there's a pretty good article on the kind of stuff I was doing at: http://developer.java.sun.com/developer/technicalArticles/wireless/midpnetwork/
Thanks,
Alex
 
yufeng
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change your URL "www.yahoo.com" to its ip address, it will work.
It is because MotoSDK emulator doesn't provide DNS lookup emulation.
-yu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic