JBoss.orgCommunity Documentation

Chapter 8. JBossWS-wsprovide

8.1. Command Line Tool
8.1.1. Examples
8.2. Maven Plugin
8.2.1. Examples
8.3. Ant Task
8.3.1. Examples

wsprovide is a command line tool and ant task that generates portable JAX-WS artifacts for a service endpoint implementation. It also has the option to "provide" the abstract  contract for offline usage. See "Using wsprovide" for a detailed walk-through.

The command line tool has the following usage:

  usage: wsprovide [options] <endpoint class name>
  options: 
  -h, --help                  Show this help message
  -k, --keep                  Keep/Generate Java source
  -w, --wsdl                  Enable WSDL file generation
  -c. --classpath=<path<      The classpath that contains the endpoint
  -o, --output=<directory>    The directory to put generated artifacts
  -r, --resource=<directory>  The directory to put resource artifacts
  -s, --source=<directory>    The directory to put Java source
  -e, --extension             Enable SOAP 1.2 binding extension
  -q, --quiet                 Be somewhat more quiet
  -t, --show-traces           Show full exception stack traces

The wsprovide tools is included in the org.jboss.ws.plugins:maven-jaxws-tools-plugin plugin. The plugin has two goals for running the tool, wsprovide and wsprovide-test, which basically do the same during different maven build phases (the former triggers the sources generation during process-classes phase, the latter during the process-test-classes one).

The wsprovide plugin has the following parameters:

Attribute Description Default
testClasspathElements

Each classpathElement provides a

library file to be added to classpath

${project.compileClasspathElements}

or

${project.testClasspathElements}

outputDirectoryThe output directory for generated artifacts.

${project.build.outputDirectory}

or

${project.build.testOutputDirectory}

resourceDirectoryThe output directory for resource artifacts (WSDL/XSD).${project.build.directory}/wsprovide/resources
sourceDirectoryThe output directory for Java source.${project.build.directory}/wsprovide/java
extensionEnable SOAP 1.2 binding extension.false
generateWsdlWhether or not to generate WSDL.false
verboseEnables more informational output about command progress.false
endpointClassService Endpoint Implementation. 

You can use wsprovide in your own project build simply referencing the maven-jaxws-tools-plugin in the configured plugins in your pom.xml file.

The following example makes the plugin provide the wsdl file and artifact sources for the specified endpoint class:

<build>
  <plugins>
    <plugin>
      <groupId>org.jboss.ws.plugins</groupId>
      <artifactId>maven-jaxws-tools-plugin</artifactId>
      <version>@pom.version@</version>
      <configuration>
        <verbose>true</verbose>
        <endpointClass>org.jboss.test.ws.plugins.tools.wsprovide.TestEndpoint</endpointClass>
        <generateWsdl>true</generateWsdl>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>wsprovide</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

 

The following example does the same, but is meant for use in your own testsuite:

<build>
  <plugins>
    <plugin>
      <groupId>org.jboss.ws.plugins</groupId>
      <artifactId>maven-jaxws-tools-plugin</artifactId>
      <version>@pom.version@</version>
      <configuration>
        <verbose>true</verbose>
        <endpointClass>org.jboss.test.ws.plugins.tools.wsprovide.TestEndpoint2</endpointClass>
        <generateWsdl>true</generateWsdl>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>wsprovide-test</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

 

The wsprovide ant task has the following attributes:

Attribute Description Default
forkWhether or not to run the generation task in a separate VM.true
keepKeep/Enable Java source code generation.false
destdirThe output directory for generated artifacts."output"
resourcedestdirThe output directory for resource artifacts (WSDL/XSD).value of destdir
sourcedestdirThe output directory for Java source.value of destdir
extensionEnable SOAP 1.2 binding extension.false
genwsdlWhether or not to generate WSDL.false
verboseEnables more informational output about command progress.false
seiService Endpoint Implementation. 
classpathThe classpath that contains the service endpoint implementation."."