Solved

client - server data format

Posted on 2002-07-17
3
192 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
3 Comments
 
LVL 4

Expert Comment

by:pellep
Comment Utility
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 200 total points
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now