Link to home
Start Free TrialLog in
Avatar of Erctheanda
Erctheanda

asked on

J2ME : Communication between a client and a J2EE application server

I am working on a wireless application extension to an existing J2EE application.

I am to come up with a"mobile" edition of a use case.
The target device is a IPAQ running SuperWABA JVM.

It has been decided that XML will be the main form of data transfer between the client and the J2EE application.

The floor plan for communication will be as follows :
1) J2ME client makes httpconnection to a Servlet (new) running alongside the exisitng application
2) Servlet calls pre - existing codes to get/process data
3) Servlet generates xml using the reponse.printwriter()
4) Servlet returns.
5) Client receives XML and parses it using a modified version of nano XML.
6) Client process and intakes User input
7) Client writes User input into XML and transfer to Server
8) Server reads XML and processes the input XML
9) Server returns

My question is : how to accomplish (7)?
I know how to write XML to a local file.. but how do i transfer it over (so that its accessable to the servlet) ?

Thanks
Avatar of Erctheanda
Erctheanda

ASKER

A contingency that i have is to replace Client to Server communication using Strings passed in as request parameters.

why XML was chosen was because the client can return a indefinate number of values.

An analogy:

Server sends client a list of questions from the database (un determined number)
client chooses the answers and sends it back

the server must know which answer is for which question.

If a XML is not possible, i will stick to the below implementation

http://myserver.com/servlet?question1=answer1&question2=answer2


Please do advise.
Avatar of Mikal613
Web Services are not considered due to system constraints.

Any other alternatives?
No offence,

But i think i have been misunderstood. I have not been clear enough, sorry.

I am having a problem transferring the xml file from client to the server in an efficient way.

Currently, I have no problems writing the XML nor parsing the XML.

My only issue is how to do it cleanly.

The transfer mechanism should be encapsulated and be transparent to anyone who plans to use my library. I have chosen to use nanoXml as my parser but the issue is how to do it "industrial" strength with no worries about performance or memory issues (some data can be quite long).
do you have wifi?usb ?  whats your communication with the server?
The legacy app runs on a J2EE server.

The medium is the internet. through Wi FI.

I feel like i am having a conversation. Thanks.
Have you looked at kxml?

http://kxml.objectweb.org/index.html
same as transfering text file ..
just set the content-type: text/xml


read abt HTTP-POST and HTTP-GET method
You will know how to send/receive.

-bhpr
for e.g. sending in response of a req ..

HTTP 200 OK
Content-type: text/xml

<?xml ..>
...
...

Thanks to all for the replies.

I have found the solution to my problems

From the client side, XML will not be used.

Instead i have wrapped up the httpconnection to append in parameters.

that way, it will appear as if there is a form passing in parameters.

This way, the applicatino will not incur additional overhead.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial