• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML communication between J2ME and J2EE

 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm planning to cough up a mobile application communicating with a J2EE application by passing around custom XML messages, and I'm looking for the best way to bind the XML documents to Java objects.
I would sure like to know about any viable frameworks/libraries that I could utilize (especially on the mobile where jar size really matters)...
 
Liam Quinn
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If XML isn't an absolute requirement, I would avoid it and instead use DataInputStream/DataOutputStream. In my experience, using DataInputStream and DataOutputStream instead of XML provides better speed and a smaller JAR.
If you really want to use XML, there's a good, small XML parser at kObjects.org.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link, Liam. I wasn't aware of that parser implementation.
The use of XML isn't a requirement per se, however, I'd like to try using an XML-over-HTTP interface to get a more robust communication system (regarding changes on the other side).
Actually my question is not specific to XML. Generally I'm looking for a framework or an implementation pattern for binding the object graph into a wire protocol/format.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need the complexity XML affords you or can you just use name=value pairs?
In my experience XML is rather wordy for many applications and, if you're users are paying by the byte, they might appreciate a terser message.
 
Jonathan Knudsen
Author
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general I would recommend not using XML for server-MIDP conversations, as well. However, that said, I have made it work. Here's an article on the subject:
http://wireless.java.sun.com/midp/articles/parsingxml/
And there's a chapter in my book that covers XML parsers.
I've also created a MIDlet that parses RSS files:
http://wireless.java.sun.com/applications/peekandpick/2.0/
I hope this is helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic