You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Morein, Arnie" <Ar...@dps.texas.gov> on 2018/02/28 17:51:00 UTC
Compound projects with XSDs, WSDLs - how to suppress duplicate
classes
I have serveral web service projects that I am converting from AXIS to CXF. When they were first written, the core types defined in the XSD files where copied into each other project; I have removed those duplications, as defined below.
The first project, ws-dls-cps, is just two fairly large XSD files which via the jaxb2-maven-plugin, generates the classes used by the other projects.
The second project, ws-dls-ics has three WSDLs that need to use the types defined in the XSDs of the ws-dls-cps project as the generate-sources and compile-time source of the aforementioned types/classes.
Each of the three WSDLs define local types that use or extend types from the CPS project. But I want to use the CPS project as the master/ancestor of the base types so I use maven-dependency-plugin / unpack execution to extract the two XSD files from the CPS project into a specific folder in the ICS project, separate from the local XSDs. Then the three local XSDs just reference them:
<xs:import namespace="urn:digimarc.com:SchemaTypes"
schemaLocation="../cps-xsd/META-INF/xsd/DigimarcSchemaTypes.xsd" />
<xs:import namespace="urn:digimarc.com:imaging"
schemaLocation="../cps-xsd/META-INF/xsd/ApplicantDataFolio.xsd" />
The WSDLs in ICS then reference the local XSD files:
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="urn:digimarc.com:SchemaTypes"
schemaLocation="../cps-xsd/META-INF/xsd/DigimarcSchemaTypes.xsd" />
<xsd:import namespace="urn:digimarc.com:imaging"
schemaLocation="../cps-xsd/META-INF/xsd/ApplicantDataFolio.xsd" />
<xsd:import namespace="http://www.digimarc.com/TXCaptureWebService/"
schemaLocation="../xsd/ImageCaptureService.xsd" />
<xsd:import namespace="http://www.digimarc.com/TXCaptureWebServiceResponse/"
schemaLocation="../xsd/ImagingResponseTypes.xsd" />
</xsd:schema>
</wsdl:types>
Everything validates in Eclipse and the Maven clean|package works file too. With one problem:
The types imported from "../xsd/ImagingResponseTypes.xsd" (see above) - which in turn is importing the ancestor types via their now local XSD files:
<s:import namespace="urn:digimarc.com:SchemaTypes"
schemaLocation="../cps-xsd/META-INF/xsd/DigimarcSchemaTypes.xsd" />
<s:import namespace="urn:digimarc.com:imaging"
schemaLocation="../cps-xsd/META-INF/xsd/ApplicantDataFolio.xsd" />
Are getting generated again to a new package (com.digimarc.txcapturewebserviceresponse), which is a complete duplication of the classes from the CPS project.
If I add the -nexclude parameter to exclude that namespace/package, it is NOT generated, but the related ObjectFactory classes of two of the WSDL packages that use the ImagingResponseTypes.xsd file, still refer to the missing package and the related ObjectFactory class:
@XmlSeeAlso({com.digimarc.txcapturewebservice.ObjectFactory.class, com.digimarc.txcapturewebserviceresponse.ObjectFactory.class, com.digimarc.schematypes.ObjectFactory.class, com.digimarc.imaging.ObjectFactory.class})
So, the question is, how do I tell wsdl2java to ignore that namespace/package and to use the ones from the CPS package?
Or is that impossible?