JBoss Community Archive (Read Only)

JBoss Web Services

wsprovide

wsprovide is a command line tool, Maven plugin 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.

Command Line Tool

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
  -a, --address               The generated port soap:address in wsdl
  -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

Examples

Generating wrapper classes for portable artifacts in the "generated" directory:

wsprovide -o generated foo.Endpoint

Generating wrapper classes and WSDL in the "generated" directory

wsprovide -o generated -w foo.Endpoint

Using an endpoint that references other jars

wsprovide -o generated -c application1.jar:application2.jar foo.Endpoint

Maven Plugin

The wsprovide tools is included in the org.jboss.ws.plugins:jaxws-tools-maven-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}

outputDirectory

The output directory for generated artifacts.

${project.build.outputDirectory}
or
${project.build.testOutputDirectory}

resourceDirectory

The output directory for resource artifacts (WSDL/XSD).

${project.build.directory}/wsprovide/resources

sourceDirectory

The output directory for Java source.

${project.build.directory}/wsprovide/java

extension

Enable SOAP 1.2 binding extension.

false

generateWsdl

Whether or not to generate WSDL.

false

verbose

Enables more informational output about command progress.

false

portSoapAddress

The generated port soap:address in the WSDL

 

endpointClass

Service Endpoint Implementation.

 

Examples

You can use wsprovide in your own project build simply referencing the jaxws-tools-maven-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>jaxws-tools-maven-plugin</artifactId>
      <version>1.2.0.Final</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>jaxws-tools-maven-plugin</artifactId>
      <version>1.2.0.Final</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>

Plugin stack dependencyThe plugin itself does not have an explicit dependency to a JBossWS stack, as it's meant for being used with implementations of any supported version of the JBossWS SPI. So the user is expected to set a dependency in his ownpom.xml to the desired JBossWS stack version. The plugin will rely on the that for using the proper tooling.

<dependencies>
  <dependency>
    <groupId>org.jboss.ws.cxf</groupId>
    <artifactId>jbossws-cxf-client</artifactId>
    <version>5.1.0.Final</version>
  </dependency>
</dependencies>

Be careful when using this plugin with the Maven War Plugin as that include any project dependency into the generated application war archive. You might want to set <scope>provided</scope> for the JBossWS stack dependency to avoid that.

Up to version 1.1.2.Final, the artifactId of the plugin was maven-jaxws-tools-plugin.

Ant Task

The wsprovide ant task (org.jboss.ws.tools.ant.WSProvideTask) has the following attributes:

Attribute

Description

Default

fork

Whether or not to run the generation task in a separate VM.

true

keep

Keep/Enable Java source code generation.

false

destdir

The output directory for generated artifacts.

"output"

resourcedestdir

The output directory for resource artifacts (WSDL/XSD).

value of destdir

sourcedestdir

The output directory for Java source.

value of destdir

extension

Enable SOAP 1.2 binding extension.

false

genwsdl

Whether or not to generate WSDL.

false

address

The generated port soap:address in wsdl.

 

verbose

Enables more informational output about command progress.

false

sei

Service Endpoint Implementation.

 

classpath

The classpath that contains the service endpoint implementation.

"."

Examples

Executing wsprovide in verbose mode with separate output directories for source, resources, and classes:

<target name="test-wsproivde" depends="init">
  <taskdef name="wsprovide" classname="org.jboss.ws.tools.ant.WSProvideTask">
    <classpath refid="core.classpath"/>
  </taskdef>
  <wsprovide
    fork="false"
    keep="true"
    destdir="out"
    resourcedestdir="out-resource"
    sourcedestdir="out-source"
    genwsdl="true"
    verbose="true"
    sei="org.jboss.test.ws.jaxws.jsr181.soapbinding.DocWrappedServiceImpl">
    <classpath>
      <pathelement path="${tests.output.dir}/classes"/>
    </classpath>
  </wsprovide>
</target>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 11:40:56 UTC, last content change 2015-08-26 13:35:20 UTC.