Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes JAXB objects to Transfer objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB objects to Transfer objects" Watch "JAXB objects to Transfer objects" New topic
Author

JAXB objects to Transfer objects

Jim Janssens
Ranch Hand

Joined: Sep 24, 2004
Posts: 210
In our project we have several services (ejb's) which can be invoked using XML. The story is like this:

[external client]--xml--[jaxb]--jaxb objects--[converter]---domain objects---[service]

[internal client]--domain objects---[service]

Thus, every service has its own domain objects. These objects are simple java beans (get/set) which describe the input fields to execute the service. We need this layer of independence because the service can also be called from inside.

So, the classes that jaxb generates to convert the XML to java need to be converter again to the domain objects. So the converter does basicly this:

domainObject.setName(jaxbObject.getName());
domainObject.setStreet(jaxbObject.getStreet());
etc...

For simple examples this may not seem a problem, but for comlex XML it becomes very error phrone to write such converter. It takes a long time to write it, test cases take even longer...

I feel like this conversion must be done automatically. Something like saying to JAXB to use our domain objects and not te generated ones...

Any one an idea ?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Why do you need both at all?


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAXB objects to Transfer objects
 
Similar Threads
convert javaobjects to xml and xml to java objects dynamically
Facade design pattern in web services
Java objects to XML, possibly using JAXB
marshalling java objects into xml
EJB and XML