E.2. cxf-codegen-plugin
Abstract
generates JAX-WS compliant Java code from a WSDL document
Synopsis
<plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>version</version> <executions> <execution> <id>generate-sources</id> <configuration> <defaultOptions> <option>...</option> ... </defaultOptions> <wsdlOptions> <wsdlOption> <wsdl>wsdlPath</wsdl> <option>...</option> ... </wsdlOption> ... </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin>
Description
The
wsdl2java
task takes a WSDL document and generates fully annotated Java code from which to implement a service. The WSDL document must have a valid portType
element, but it does not need to contain a binding
element or a service
element. Using the optional arguments you can customize the generated code.
WSDL options
At least one
wsdlOptions
element is required to configure the plug-in. The wsdlOptions
element's wsdl
child is required and specifies a WSDL document to be processed by the plug-in. In addition to the wsdl
element, the wsdlOptions
element can take a number of children that can customize how the WSDL document is processed.
Tip
More than one
wsdlOptions
element can be listed in the plug-in configuration. Each element configures a single WSDL document for processing.
Default options
The
defaultOptions
element is an optional element. It can be used to set options that are used across all of the specified WSDL documents.
Important
If an option is duplicated in the
wsdlOptions
element, the value in the wsdlOptions
element takes precedent.
Options
The options used to manage the code generation process are reviewed in the following table.
Option | Interpretation |
---|---|
-? | Displays the online help for this utility. |
-help | |
-h | |
-fe frontend | Specifies the front end used by the code generator. Possible values are jaxws , jaxws21 , and cxf . The jaxws21 frontend is used to generate JAX-WS 2.1 compliant code. The cxf frontend, which can optionally be used instead of the jaxws frontend, provides an extra constructor for Service classes. This constructor conveniently enables you to specify the Bus instance for configuring the service. Default is jaxws . |
-db databinding | Specifies the data binding used by the code generator. Possible values are: jaxb , xmlbeans , sdo (sdo-static and sdo-dynamic ), and jibx . Default is jaxb . |
-wv wsdlVersion | Specifies the WSDL version expected by the tool. Default is 1.1 .[a] |
-p [wsdlNamespace=]PackageName | Specifies zero, or more, package names to use for the generated code. Optionally specifies the WSDL namespace to package name mapping. |
-b bindingName | Specifies zero, or more, JAXWS or JAXB binding files. Use spaces to separate multiple entries. |
-sn serviceName | Specifies the name of the WSDL service for which code is to be generated. The default is to generate code for every service in the WSDL document. |
-d output-directory | Specifies the directory into which the generated code files are written. |
-catalog catalogUrl | Specifies the URL of an XML catalog to use for resolving imported schemas and WSDL documents. |
-compile | Compiles generated Java files. |
-classdir complile-class-dir | Specifies the directory into which the compiled class files are written. |
-client | Generates starting point code for a client mainline. |
-clientjar jar-file-name |
Generates the JAR file that contains all the client classes and the WSDL. The specified
wsdlLocation does not work when this option is specified.
|
-server | Generates starting point code for a server mainline. |
-impl | Generates starting point code for an implementation object. |
-all | Generates all starting point code: types, service proxy, service interface, server mainline, client mainline, implementation object, and an Ant build.xml file. |
-ant | Generates the Ant build.xml file. |
-autoNameResolution |
Automatically resolve naming conflicts without requiring the use of binding customizations.
|
-keep | Instructs the tool to not overwrite any existing files. |
-defaultValues [=DefaultValueProvider] | Instructs the tool to generate default values for the generated client and the generated implementation. Optionally, you can also supply the name of the class used to generate the default values. By default, the RandomValueProvider class is used. |
-nexclude schema-namespace[=java-packagename] | Ignore the specified WSDL schema namespace when generating code. This option may be specified multiple times. Also, optionally specifies the Java package name used by types described in the excluded namespace(s). |
-exsh (true /false ) | Enables or disables processing of extended soap header message binding. Default is false . |
-dns (true /false ) | Enables or disables the loading of the default namespace package name mapping. Default is true . |
-dex (true /false ) | Enables or disables the loading of the default excludes namespace mapping. Default is true . |
-wsdlLocation wsdlLocation | Specifies the value of the @WebService annotation's wsdlLocation property. |
-xjcargs | Specifies a comma separated list of arguments to be passed to directly to the XJC when the JAXB data binding is being used. To get a list of all possible XJC arguments use the -xjc-X . |
-noAddressBinding | Instructs the tool to use the Apache CXF proprietary WS-Addressing type instead of the JAX-WS 2.1 compliant mapping. |
-validate | Instructs the tool to validate the WSDL document before attempting to generate any code. |
-v | Displays the version number for the tool. |
-verbose | Displays comments during the code generation process. |
-quiet | Suppresses comments during the code generation process. |
-exceptionSuper |
Superclass for fault beans generated from
wsdl:fault elements (defaults to java.lang.Exception ).
|
-reserveClass classname |
Used with
-autoNameResolution , defines a class names for wsdl-to-java not to use when generating classes. Use this option multiple times for multiple classes.
|
-allowElementReferences[=true] , -aer[=true] |
If
true , disregards the rule given in section 2.3.1.2(v) of the JAX-WS 2.2 specification disallowing element references when using wrapper-style mapping. Default is false .
|
-asyncMethods[=method1,method2,...] |
List of subsequently generated Java class methods to allow for client-side asynchronous calls; similar to
enableAsyncMapping in a JAX-WS binding file.
|
-bareMethods[=method1,method2,...] |
List of subsequently generated Java class methods to have wrapper style (see below), similar to
enableWrapperStyle in JAX-WS binding file.
|
-mimeMethods[=method1,method2,...] |
List of subsequently generated Java class methods to enable mime:content mapping, similar to
enableMIMEContent in JAX-WS binding file.
|
-faultSerialVersionUID fault-serialVersionUID |
How to generate suid of fault exceptions. Possible values are:
NONE , TIMESTAMP , FQCN , or a specific number. Default is NONE .
|
-mark-generated |
Adds the @Generated annotation to the generated classes.
|
wsdlfile | The path and name of the WSDL file to use in generating the code. |
[a]
Currently, Apache CXF only provides WSDL 1.1 support for the code generator.
|