This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best Practices for xsd to Java, when both are already defined

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So we have a Java Object Model for our orders, and there is an XSD (we call is a CDM) for transferring the Order to Oracle Financials. So our object model doesn't match the Oracle model. Both are already defined. I want to find the best way to convert our Order object to a SOAP message to the Web Service that expects the XML to be in the xsd format.

Any suggestions?

Mark
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When both endpoints already exist you are pretty much stuck doing a transformation. The transform could be at the XML point (via XSLT) or in Java at one end (traversal of the object tree to create a different object tree), followed by a cleaner XML serialization/deserialization (JAXB or XMLBeans). If througput matters (large volumes of smaller documents), I'd be more inclined towards the latter approach. Bottom line: impedence mismatch is a pain.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Reid.

Those were basically the two options that I have been weighting, while also looking at Castor XML to write a mapping file that maps the Object to the XSD. The only thing with that one is any Castor overhead, and trying to find xdoclet tags that we can include in the object that will automatically generate the mapping files for us.

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still looking to see if there are any more suggestions.

Also, there are methods in our Domain Object to convert the Object to the XML. I am most likely going to move those methods out of the domain object and into a Decorator/Wrapper object.

Mark
[ January 24, 2006: Message edited by: Mark Spritzler ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic