I use a axis to auto-generate webservice artifacts which I then convert into objects used within our application. Is there a sensible pattern for doing this ? We have written transform methods to output our objects from the axis created objects, at other times we have written an intermediate set of transformer classes that transform the axis objects to our application objects? Is there a common way of approaching this?
If I understand correctly, you want to use Axis WSDL2Java feature to generate code from a WSDL and then map that to your existing application object model. In that case, you might want to consider to use Axis with JiBX binding.
If the goal is to translate the "axis generated" to your business objects you can try a tool like dozer (http://dozer.sourceforge.net/) that is a "mapper" to copy from an object implementation to another implementation. It don't know how to use it (I think you have to explain the translation in xml files) and then it should work (I didn't used myself but some colleagues used it for a similar purpose and it seemed to work)
I guess there is a common sense way of doing that. Abstract a bit your mind and imagine layers.
The convertion layer can be done in multiple ways.
If the conversion is simple, you can merge the first and second layer almost in one. Extend the POJOS to provide transformation functionality. This will give you, at least two pieces of code, the automatically generated and the extensions + functionality
If we're talking about huge XMLs that need to be converted to multiple small application objects. Ok, leave the first layer as it is and in the second use:
I hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With