This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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.
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.