Search code examples
eclipseweb-servicesautomationrad

Automate the process of generating webservice clients


I am using RAD 7.5 (based on Eclipse) to generate client code from webservice WSDLs. There are actually 2 or 3 that need to be generated together to produce one client. Is there a way to automate the process of stepping through the webservice client wizard, selecting the JAX-WS binding files for all WSDLs? Ideally, this process would also create the Jar file after the Java code has been generated.

Is it possible to automate this in RAD/Eclipse?


Solution

  • You can use Maven with Eclipse.

    There is a plugin for Maven

    http://jax-ws-commons.java.net/jaxws-maven-plugin/examples/using-wsdlLocation.html

    <project>
      ...
      <dependencies>
          ...
        <dependency>
          <groupId>com.sun.xml.ws</groupId>
          <artifactId>jaxws-rt</artifactId>
          <version>2.2.6</version>
        </dependency>
        ...
      </dependencies>
      ...
      <build>
        ...
        <plugins>
          <plugin>
            <groupId>org.jvnet.jax-ws-commons</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
              <execution>
                <goals>
                  <goal>wsimport</goal>
                </goals>
                <!-- Following configuration will invoke wsimport once for each wsdl. -->
                <configuration>
                  <wsdlLocation>http://example.com/mywebservices/*</wsdlLocation>
                  <wsdlDirectory>src/mywsdls</wsdlDirectory>
                  <wsdlFiles>
                    <wsdlFile>a.wsdl</wsdlFile>                         <!-- produces wsdlLocation = http://example.com/mywebservices/a.wsdl -->
                    <wsdlFile>b/b.wsdl</wsdlFile>                       <!-- produces wsdlLocation = http://example.com/mywebservices/b/b.wsdl -->
                    <wsdlFile>${basedir}/src/mywsdls/c.wsdl</wsdlFile>  <!-- produces wsdlLocation = /path/to/basedir/src/mywsdls/c.wsdl -->
                  </wsdlFiles>
                </configuration>
              </execution>
            </executions>
          </plugin>
          ...
        </plugins>
        ...
      <build>
      ...
    </project>