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
Solved

client - server data format

Posted on 2002-07-17
3
195 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
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 200 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
even odd program using while loop 3 60
MySQL  on Tomcat 8 68
eclipse buid path vs tomcat lib path 10 34
eclipse console opening separately 2 29
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This video teaches viewers about errors in exception handling.
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.

839 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