aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Transfer XML object from server to client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Transfer XML object from server to client" Watch "Transfer XML object from server to client" New topic
Author

Transfer XML object from server to client

Elena Taube
Greenhorn

Joined: Dec 06, 2005
Posts: 21
Hi everyone,
my client should create the XML files and save it on the hard drive. As the information that should be written in the XML file is on the server, my server (one EJB) will perform the XML- creation operation. I am planning to use JDOM for XML creation.
After the xml object is created the server returns it to the client.

My question is: What type (String, org.jdom.Document, OutputStream or etc.) is the better to use for transfer the XML object from the server to client?
Thanks a lot for your help!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I am confused. If the data that goes into the XML file is on the server side, why doesn't the Server side create the XML File?

I don't think the different types of return type makes much of a difference. You could create the File on the server and send that over. The difference of any of the types is kind of really small.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Elena Taube
Greenhorn

Joined: Dec 06, 2005
Posts: 21
Hi Mark,

Thanks a lot for your fast answer.
The xml file should be saved (on hard drive) on the client. That is my problem.

But I�m not sure, if it is a good idea to generate XML on the server.

1. XML file generate on the client.
The client receives the information from the server and use it for the XML generation.

2.XML file generate on the server.
The server generate XML and transfer it to the client as one object. But what object can I use to transfer?

I�m not sure if the using of the JDOM is a good idea. I am thinking about to create it with StringBuffer or with java.io.Writer.
How do you think about it?
Thank a lot!
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

it mostly depends on your design to wether generate the XML on the server or in the client.
if you generate XML on the server you introduce some loads on your server depend on how much sophesticated is your XML generation.

if you generate xml on clients you may have un-ceneteralized buziness logic , incase that you change something in the server that affect the xml generation you must update all clients.

I would use StringBuffer to create the xml , as it sounds your xml is not such sophisticated , using an string buffer (imho) is much speedier than using DOM to create XML.

you can transfer the xml content to client (in case that you generate it in server) in a simplest possible objet , as simpler your object is your serialization will be simpler and faster.


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
 
Consider Paul's rocket mass heater.
 
subject: Transfer XML object from server to client