0

I use maven-jaxb2-plugin to generate classes from wsdl file. My wsdl fila has multiple schema entries, but i need only one. So is it possible to specify which shema i'd like to generate. maybe in pom.xml or xjb binding file ? My pop.xml maven-jaxb2-plugin configuration:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.8.0</version>
    <executions>
        <execution>
           <id>some_id</id>
           <goals>
               <goal>generate</goal>
           </goals>
           <configuration>
               <schemaLanguage>WSDL</schemaLanguage>
               <schemaDirectory>${basedir}/src/main/resources/wsdl/</schemaDirectory>
               <schemaIncludes>
                   <include>*.wsdl</include>
               </schemaIncludes>
               <bindingIncludes>
                   <include>binding.xjb</include> // is 
               </bindingIncludes>
               <generatePackage>my.custom.package</generatePackage> -->
               <generateDirectory>target/generated-sources/jaxb</generateDirectory>
           </configuration>
     </execution>

My wsdl file looks something like this:

<?xml version="1.0" encoding="utf-8"?>    
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" ... other namespaces>    
  <types>    
    <xs:schema targetNamespace="http://www.custom.se/webservices/" elementFormDefault="qualified" attributeFormDefault="unqualified"     xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="Elem">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="SeqNo" type="xs:string"/>
            <xs:element name="Method" type="xs:string"/>
            <xs:element name="Id" type="xs:string"/>
            <xs:element name="UserId" type="xs:string"/>
            <xs:element name="ResultCode" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    <xs:schema targetNamespace="http://www.custom.se/webservices/publishing/">
    ....
    </xs:shema>

    <xs:schema targetNamespace="http://www.custom.se/webservices/smth/">
    ....
    </xs:shema>

    ....

I appreciate any help.

Zygimantas Gatelis
  • 1,923
  • 2
  • 18
  • 27

1 Answers1

0

What do you want to achieve in the end? Since you are using jaxb plugin and not jaxws plugin I assume you are not interested in java code generated from WSDL constructs. So the goal is to minimize the number of generated classes in the resulting jar?

Well, in this case the easiest solution is to generate them all and then compile (or package) selectively.

user568826
  • 581
  • 5
  • 16