Skip to main content

communication midlet - servlet

2 replies [Last post]
johnyjj2
Offline
Joined: 2009-08-16

Hello!

I'd like to create application in Java for mobile phone which can communicate with the user and based on this communication create little text file. I want to send this text file from mobile phone to server.

Is it possible to do it with MIDlet sending data to servlet installed on server with GlassFish? I guess it is possible.

Later I'd like to use some more sophisticated algorithms in my application which may require extensive floating point math and so on - this is why later I will need to change my application from CLDC-MIDlet to CDC.

Is it possible to send data from Java ME CDC on mobile phone to servlet on GlassFish?

Thanks very much for your help in advance
Greetings :-)!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sreeram Duvur

On Sep 20, 2009, at 8:36 AM, glassfish@javadesktop.org wrote:

> Hello!
>
> I'd like to create application in Java for mobile phone which can
> communicate with the user and based on this communication create
> little text file. I want to send this text file from mobile phone to
> server.
>
> Is it possible to do it with MIDlet sending data to servlet
> installed on server with GlassFish? I guess it is possible.
>

You can use Jersey on Glassfish server to act as a web service end
point for file uploads. Use HttpUrlConnection class in the midlet to
post to the upload web service.

Alternatively, if it is just plain text, you could also just post a
form url to a servlet.

I am not sure if HttpURLConnection class is available in CDC.

Sreeram

> Later I'd like to use some more sophisticated algorithms in my
> application which may require extensive floating point math and so
> on - this is why later I will need to change my application from
> CLDC-MIDlet to CDC.
>
> Is it possible to send data from Java ME CDC on mobile phone to
> servlet on GlassFish?
>
> Thanks very much for your help in advance
> Greetings :-)!
> [Message sent by forum member 'johnyjj2' (johnyjj2@gmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=364834
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

[att1.html]

johnyjj2
Offline
Joined: 2009-08-16

Thanks very much! It is exactly what I was looking for :)!

I found such a code: http://forum.midlety.net/viewtopic.php?t=610 (9th post) - there is code for MIDlet and servlet. I can use Wireless Toolkit 2.5.2 to create MIDlet and simply copy that code to that NameOfMIDlet.java. However I don't know how to create receiver of messages (servlet) on GlassFish. I found example http://glassfish.dev.java.net/downloads/quickstart/hello.war but it is file with .war extension. Can you give me, please, any link to tutorial how to create this war file from Java code for servlet?

Greetings!

PS I found "HttpURLConnection is found in J2ME CDC profiles such as J2ME Foundation Profile" on third page of http://www.google.pl/search?hl=pl&q=HttpURLConnection+cdc&btnG=Szukaj&lr=