This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

CLDC-HTTP communication.I am not getting any error ?  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am developing a Palm App with J2ME and CLDC API's.
I made a sample application and tested in Kyocera Palm device and i am so thrilled to run it.
Now i want to make my application to communicate with a remote Oracle database.For this i am planning to make my Palm application to talk with Servlets in a webserver, so that i can send and recieve data extensively.
But i am not able to do the communication module successfully.
I tried out a sample code and it didn't throw any exception and the return values of every function said it is sucess.So i thought i did all !!!
And later i tried with a jung (invalid) URL and i got shocked to see the same result ..i mean no error.All the branches of the program returned success values.
What does it mean ??? So my application actually not contacting any URL. Otherwise it should throw some invalid URL exception.....right ?
But in both the cases the number of bytes returned by read function was 0 and none of the other connection function throwed any exception,
like connect(),OpenInputStream...etc.
This is my sample code.

-----------------------------------------------------------------

StreamConnection m_Conn = null; //Connection

DataInputStream m_In = null; //Input Stream

String sURL = "http://63.221.48.58:8080/servlets/AirScriptLogin";

try

{

StringBuffer sbInput = new StringBuffer("");

int iData;

int iCount = 0;

m_Conn = (StreamConnection)Connector.open(sURL,Connector.READ_WRITE,true);

m_In = m_Conn.openDataInputStream();

for(iCount = 0 ; (iData = m_In.read()) > 0 ; iCount++)

{

sbInput.append((char)iData);

}

m_In.close();


MsgTxtBox.setText("Recd :"+sbInput.toString());

MsgTxtBox.paint();

}

catch (RuntimeException e)

{

MsgTxtBox.setText(e.getMessage());

MsgTxtBox.paint();

}

catch (Exception e)

{

MsgTxtBox.setText(e.toString());

MsgTxtBox.paint();

}

------------------------------------------------------------------------

If i understood anything wrongly pls correct me.And pls tell me what should i do....i am really in a trouble.
Pls let me know if u need any more info ,so that u can give me a better reply.
Hope to hear from u soon.
Thanks and Regards
Joe Augustine
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haven't tried any of it on the Kyocera. Note that the "http:" protocol only works on Palm devices that support web clipping, and that you have to configure the device to use the Palm.Net gateway. The "testhttp:" protocol works as long as you've configured your device to use a PPP connection. I think the latter is more what you'd want. However, note that both protocols as implemented in the Palm CLDC are strictly experimental and have problems. I wouldn't try building any real apps with them, you should rather wait until Sun releases its MIDP implementation for the Palm, which will have proper HTTP support.
Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!