maven-jaxb plugin - Two classes have the same XML type name -


following problem, have 2 wsdl files have generate stubs. both wsdl files contains same xml type names (second wsdl further stage of first wsdl).

i generate stubs following configuration:

    <plugins>     ..         <plugin>             <groupid>org.jvnet.jaxb2.maven2</groupid>             <artifactid>maven-jaxb2-plugin</artifactid>             <version>0.7.1</version>             <executions>                 <execution>                     <id>ws-source-gen-phase1</id>                     <goals>                         <goal>generate</goal>                     </goals>                     <configuration>                         <removeoldoutput>true</removeoldoutput>                         <extension>true</extension>                         <schemadirectory>src/main/resources/meta-inf/schema/xyz/</schemadirectory>                         <args>                             <arg>-wsdl</arg>                             <schemafiles>src/main/resources/meta-inf/schema/xyz/service1.wsdl</schemafiles>                             <arg>-xautonameresolution</arg>                         </args>                         <generatepackage>com.xyz.ws</generatepackage>                         <generatedirectory>${project.build.directory}/generated-sources/xjc1</generatedirectory>                     </configuration>                 </execution>                 <execution>                     <id>ws-source-gen-phase2</id>                     <goals>                         <goal>generate</goal>                     </goals>                     <configuration>                         <removeoldoutput>true</removeoldoutput>                         <extension>true</extension>                         <schemadirectory>src/main/resources/meta-inf/schema/xyz/</schemadirectory>                         <args>                             <arg>-wsdl</arg>                             <schemafiles>src/main/resources/meta-inf/schema/xyz/service2.wsdl</schemafiles>                             <arg>-xautonameresolution</arg>                         </args>                         <generatepackage>com.xyz.ws.phase2</generatepackage>                         <generatedirectory>${project.build.directory}/generated-sources/xjc2</generatedirectory>                     </configuration>                 </execution>             </executions>         </plugin>     </plugins> 

this generates stubs if try use them spring-ws error below.

applicationcontext.xml:

<bean id="messagefactory" class="org.springframework.ws.soap.saaj.saajsoapmessagefactory" />  <bean id="xyzmarshaller" class="org.springframework.oxm.jaxb.jaxb2marshaller">     <property name="contextpath"         value="com.xyz.ws:com.xyz.ws.phase2" /> </bean> <bean id="xyzunmarshaller" class="org.springframework.oxm.jaxb.jaxb2marshaller">     <property name="contextpath"         value="com.xyz.ws:com.xyz.phase2" /> </bean>  <bean id="xyzservicetemplate" class="org.springframework.ws.client.core.webservicetemplate">     <constructor-arg ref="messagefactory" />     <property name="marshaller" ref="xyzmarshaller"></property>     <property name="unmarshaller" ref="xyzunmarshaller"></property>     <property name="defaulturi" value="${thiemerightaccessservice.uri}" /> </bean>  <bean id="xyzserviceclient"     class="com.ebcont.gtv.radbase.business.service.impl.xyzserviceclientimpl">     <constructor-arg ref="xyzservicetemplate"></constructor-arg> </bean> 

error:

two classes have same xml type name "{http://status.ws.xyz.com/}getxyzobject1". use  @xmltype.name , @xmltype.namespace assign different names them. ... 

apparently can't mix com.xyz.ws , com.xyz.ws.phase2 - jaxb won't know wich class create {http://status.ws.xyz.com/}getxyzobject1.

you need create 2 sets of marshaller/unmarshaller/template/client 2 packages.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -