• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

XML data transfer?

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Application: an EJB application

Scenario: Invoking an Entity Bean from inside a Session Bean. Send Entity Bean's attributes to client for presentation for inistance. We normally create a view class(like UserView) over the Entity Bean and send this class to the mediator. And this view class will be sent to presentation layer (for example a JSP).

Question: It'd be much more flexible if data (Entity Bean's attributes) will be sent to client as a XML file. If we want to pursue this approach

1- is it true that we do not need thoes view classes any more, and instead we should write Entity Beans' data into an XML file?

2- Then what are our choices to send these XML files to client?

3- What is the common architecture for XML data transportation?

Thank you for your help.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should read JAXB concept, there are many open source like castor.org
by which you can read/write xml data.
There are two ways -
1. You can create dom object at the server side and send this object to the client.

2. Or create dom object and send xml stream to the client.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot think of a single good reason why an EJB should either send or receive XML. EJBs should deal with objects, XML is for inter-system communication or perhaps used for rendering to other formats.

Get your bean to return a transfer object to the client which can then marshall it to XML.
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic