• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with HttpConnection

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Likely a bug. Have you tried running the same code in Sun's MIDP emulator?
Eric
 
Alex Dean
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic