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:
The following example does the same, but is meant for use in your own testsuite:
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.
![]() | 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:
9 Comments
comments.show.hideOct 20, 2011
Stian Thorgersen
Would be helpful if the Maven example included what dependencies are required to get it to work + maybe also list the versions available of the plugin?
Dec 19, 2011
Alessio Soldano
There're some test projects included in the plugin sources; you can have a look at http://anonsvn.jboss.org/repos/jbossws/projects/plugins/maven/jaxws-tools/trunk/src/test/resources/test-embedded/ for the latest trunk.
Apr 25, 2012
Peter Fry
I'm unfortunately stuck in the ant world and can't figure out what the value of
<classpath refid="core.classpath"/>
is. For the wsconsume task I just added all of the jars in the jboss as 7.1 modules directory. That isn't working for wsprovide.
Apr 26, 2012
Alessio Soldano
The org.jboss.ws.tools.ant.WSProvideTask lives in jbossws-common jar. So you need that for sure. For the other dependencies, have a look at the modules/org/jboss/ws/tools/common/main/module.xml which has the definition for the module that's used to set the classloader when running the same tool from command line.
If you still have problems, please create a thread on the forum.
Jun 16, 2014
Daniel Castro
Still wandering how to make this work.
I have a wsdl and want to generate the impl class and dependencies from wsdl. Seems to be wsprovide what I need.
But even following the instructions I get errors like
Plugin execution not covered by lifecycle configuration: org.jboss.ws.plugins:maven-jaxws-tools-plugin:1.1.2.Final:wsprovide (execution: default, phase: process-classes)
I am using JBoss 7.1.1 Final that uses JBoss WS Client - Stack CXF Runtime Client 4.0.2.GA
An using Nexus as my Maven provider.
Jun 16, 2014
Alessio Soldano
Daniel,
I believe what you need is wsconsume. Consider having a look at the example at https://community.jboss.org/wiki/JAXWSToolsMavenPluginSample
Alessio
Jun 16, 2014
Daniel Castro
I did exactly as told using this link as reference and still get Plugin execution not covered by lifecycle configuration: org.jboss.ws.plugins:maven-jaxws-tools-plugin:1.1.1.Final:wsconsume (execution: My execution, phase: generate-sources)
Also I am not sure about what version should be using instead of jbossws-cxf-client 4.1.1 since my Jboss uses 4.0.2GA.
But I did not update and made as the link says to do. Also the compiler using 2.3.1 seems to be outdated, my projects uses 3.0 but I kepts 2.3.1 to reduce the entropy to a minimum. :)
Jun 23, 2014
Alessio Soldano
I've thought about this a bit and figured out you're probably using Eclipse and getting the error in there only, aren't you? If you run Maven from command line you have no problems, right?
It might simply be a known M2E issue, which can be overcome by adding something like this to your pom.xml:
Jun 16, 2014
Daniel Castro
This is my pom.xml