• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpConnection

 
Dilip Kulkarni
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use requestMethod as HttpConnection.GET or HttpConnection.POST I get Method not supported Exception in J2ME 2.2 Emulator. Please give the solution.
 
payal agrawal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the URL below;

How to implement networking on mobile devices
http://www.java-tips.org/content/view/753/73/
 
Dilip Kulkarni
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply. I have similar code. It builds fine , but when I try to send data or upload file on tomcat server through Emulator I get IOException Method not supported HttpConnection.GET
 
payal agrawal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code should support MIDP1.0 and CLDC1.0 profile.Though there are no specific API permission to set, you should be able to run it successfully.
Below are the links to send data to tomcat server through MIDLet.I havent tried uploading file.But this works fine in emulator 2.2

Sending data to Servlet and getting the response
http://www.java-tips.org/content/view/537/73/
 
Dilip Kulkarni
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot ! It worked. The mistake, I was doing, setting requestMethod before setting requestProperty "User-Agent"
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sample code posted in www.java-tips.org/content/view/753/73/
throws this Exception

startApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
at httpMIDLET.getData(+162)
at httpMIDLET.startApp(+8)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)

Rgds,

Seetesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic