This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.