?
Solved

client - server data format

Posted on 2002-07-17
3
Medium Priority
?
199 Views
Last Modified: 2010-03-31
I am writing a client-server java program.  It will read XML data files on the user's computer, then send the data to the server.  

Question 1:
It seems I could either:
Have the client read the XML files, bind it to java objects and then send the objects to the server

or:
Have the client read the XML files, send the XML to the server and have the server bind the XML to java objects

Which is usually done? why?

Question 2:

The choices for XML data binding (reading XML from a file and putting that data in java objects) appear to be JAXP, Castor, and Zeus.

What are the strengths and weaknesses of each?  Why would I choose one over the other?
0
Comment
Question by:jdaues
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:pellep
ID: 7160998
I'd advise to send the XML to the server and then parse it server-side. That way, if the XML structure changes, you won't have to update all the clients, just the server. I try to go by the rule 'as little intelligence in the client as possible'.
0
 
LVL 3

Accepted Solution

by:
gandalf94305 earned 800 total points
ID: 7161024
I recommend simply passing the XML on to the server. The extra mapping of XML to Java objects and then serializing them to send data to the server does not make sense on the client, unless you need to perform any operations on the XML data that only the client can perform.

The disadvantages of parsing XML on the client side are
- you need a more heavy-weight client
- it will cost performance on the client
- for network transfer you have to serialize objects, anyway.
- you don't have to care what the server is written in (Java, Perl, C, C++, ...)

If you are concerned about bandwidth, compress the file using zip or jar format.

If you are concerned about security, sign the file (compressed or clear text) on the client.

For transmitting the actual data, you may want to consider SOAP (see http://jakarta.apache.org).

On the server, use your favourite mapping tool or don't. In my experience, automatic mapping is not as efficient as hand-coded mappings. Very often, it is fairly easy to traverse an XML structure and build a rather simple Java structure from it. This is getting even more important if you use an object-relational mapping for persistent data on the server. On the other hand, if you use an XML database (check out http://jakarta.apache.org or http://sourceforge.net), you don't really care because you can store and retrieve XML natively.

Personally, I view XML-based notations as interchange formats, not representation formats, i.e., it is nice to have a vendor-, platform-, operating-system- and hardware-independent syntax but such independent beasts are rarely efficient enough as internal data structures in a performant application.

Cheers,
--gandalf.
0
 

Author Comment

by:jdaues
ID: 7172771
Ok, parse on the server side.

As far as mapping, I think that hand-coding is not a practical solution for me as there will be numerous schema.  I am leaning towards Zeus at the moment.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question