My application is divided into two layers, where the backend layer exposes a bunch of web services, and the presentation layers consumes those to obtain business data.
In order to make my construction as automatic as possible, I package all my resulting WSDL and associated XSD files into a ZIP dependency (using Maven assembler plugin), which gets uploaded to my nexus on the install phase.
Then on the UI POM I unpack this ZIP file (using maven dependency plugin) into a local directory (src/main/resources/wsdl), then use CXF-CODEGEN plugin to generate clients.
The problem is -- many of these services share common model entities, for instance a lot of methods use the Catalogue class, which is an entity I use for objects that consist of an Id and a text value.
With CXF generated code I end up with a different Catalogue class (with differente package name) for each Web Service I have, thus losing OO polimorphism capabilities in my code since they are all different classes in practice.
I've heard you can avoid this problem by somehow compiling XSD classes first into something called "episodes" and then feeding those episode files to CXF in order to tell it to take advantage of them instead of generating classes.
I've tried to add an additional compilation step in which I run maven-jaxb2-plugin to generate the classes from XSD, but I get a org.xml.sax.SAXParseException; (...) 'catalogueDTO' is already defined exception since this class is repeated along the XSD files.
Can anyone point me in the right direction?
No comments:
Post a Comment