Fork me on GitHub

Using binding files

External binding files can be passed to wsimport mojo in two ways:

  • using bindingFiles configuration element - absolute and/or relative paths can be used. Note that relative path have their base directory set to src/jaxws
    <project>
      ...
      <dependencies>
          ...
        <dependency>
          <groupId>com.sun.xml.ws</groupId>
          <artifactId>jaxws-rt</artifactId>
          <version>2.2.10</version>
        </dependency>
        ...
      </dependencies>
      ...
      <build>
        ...
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.6</version>
            <executions>
              <execution>
                <goals>
                  <goal>wsimport</goal>
                </goals>
                <!-- Following configuration will pass ${project.basedir}/src/remote-xjc/bindings.xjc and ${project.basedir}/src/jaxws/bindings-default.xjc to wsimport. -->
                <configuration>
                  <bindingFiles>
                    <bindingFile>${project.basedir}/src/remote-xjc/bindings.xjc</bindingFile>
                    <bindingFile>bindings-default.xjc</bindingFile>
                  </bindingFiles>
                  <wsdlUrls>
                    <wsdlUrl>http://example.com/mywebservices/MyService?WSDL</wsdlUrl>
                  </wsdlUrls>
                </configuration>
              </execution>
            </executions>
          </plugin>
          ...
        </plugins>
        ...
      <build>
      ...
    </project>
  • using bindingDirectory configuration element - all XML files from this directory will be passed to wsimport
    <project>
      ...
      <dependencies>
          ...
        <dependency>
          <groupId>com.sun.xml.ws</groupId>
          <artifactId>jaxws-rt</artifactId>
          <version>2.2.10</version>
        </dependency>
        ...
      </dependencies>
      ...
      <build>
        ...
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.6</version>
            <executions>
              <execution>
                <goals>
                  <goal>wsimport</goal>
                </goals>
                <!-- Following configuration will pass all XML files from ${project.basedir}/src/bindings to wsimport. -->
                <configuration>
                  <bindingDirectory>${project.basedir}/src/bindings</bindingDirectory>
                  <wsdlUrls>
                    <wsdlUrl>http://example.com/mywebservices/MyService?WSDL</wsdlUrl>
                  </wsdlUrls>
                </configuration>
              </execution>
            </executions>
          </plugin>
          ...
        </plugins>
        ...
      <build>
      ...
    </project>