java - Maven JAXB 2 Plugin - how to setup to use cross scheme dependencies -
using maven-jaxb2-plugin generate jaxb classes 2 wsdl schemas related each other.
the classes generated this:
com - accounts    |- payments    |- other   maven-jaxb2-plugin set this:
<plugin>    <groupid>org.jvnet.jaxb2.maven2</groupid>        <artifactid>maven-jaxb2-plugin</artifactid>        <version>0.13.1</version>        <executions>            <execution>                <id>unipayments</id>                <goals>                    <goal>generate</goal>                </goals>                <configuration>                     <schemalanguage>wsdl</schemalanguage>                     <args>                         <arg>-npa</arg>                     </args>                     <schemas>                         <schema>                             <url>http://...accounts?wsdl</url>                         </schema>                     </schemas>                </configuration>             </execution>             <execution>                 <id>accounts</id>                 <goals>                    <goal>generate</goal>                 </goals>                 <configuration>                    <schemalanguage>wsdl</schemalanguage>                    <args>                        <arg>-npa</arg>                    </args>                    <schemas>                        <schema>                           <url>http://...payments?wsdl</url>                        </schema>                     </schemas>                 </configuration>              </execution>     </executions> </plugin>   the annotations of 1 of generated classes (almost same anywhere):
@xmlaccessortype(xmlaccesstype.field) @xmltype(name = "inputtemplate", namespace = "http://...payments", proporder = {}) public class inputtemplate {...}   the issue soap accounts jaxb classes have nested element of class specified above came payments scheme. so, marshaller throws exception when query object of accounts service has payment's inputtemplate child:
unexpected element (uri:"http://...payments", local:"inputtemplate").  expected elements <{}inputtemplate>   don't know why happens though, each class has namespace specified.
so, how let jaxb classes cross scheme dependency work using plugin?
this:
unexpected element (uri:"http://...payments", local:"inputtemplate"). expected elements <{}inputtemplate>
actually points not problem schema dependencies rather problem namespaces. inputtemplate element known expected in default namespace. wrong elementformdefault or this.
to answer question, inter-schema dependencies best handled if compile schemas separately (separate maven modules) , include dependencies episodes.
https://github.com/highsource/maven-jaxb2-plugin/wiki/using-episodes
Comments
Post a Comment