Author: buildbot
Date: Thu Feb 14 16:57:30 2019
New Revision: 1040405
Log:
Production update by buildbot for cxf
Modified:
websites/production/cxf/content/cache/docs.pageCache
websites/production/cxf/content/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.
Modified:
websites/production/cxf/content/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
==============================================================================
---
websites/production/cxf/content/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
(original)
+++
websites/production/cxf/content/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
Thu Feb 14 16:57:30 2019
@@ -117,7 +117,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p>CXF includes a Maven plugin which can generate
java artifacts from WSDL. Here is a simple example:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><plugin>
+<pre class="brush: xml; gutter: false; theme: Default"><plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
@@ -126,7 +126,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
-
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
+
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/myService.wsdl</wsdl>
@@ -141,7 +141,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</plugin>
</pre>
</div></div><p>In this example we're running the wsdl2java goal in the
generate-sources phase. By running <strong>mvn generate-sources</strong>, CXF
will generate artifacts in the <sourceRoot> directory that you specify.
Each <wsdlOption> element corresponds to a WSDL that you're generating
artifacts for. The WSDL location is specified via the <wsdl> option.
Following <a shape="rect" class="external-link"
href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html">Maven
standard directory layout</a>, if you're planning on packaging the WSDL in the
JAR you're creating, you'll want the WSDL above in /src/main/resources/
(alternatively in a subfolder underneath it if desired to avoid placing
resources in the root of a JAR); else use the /src/main/config folder to keep
the WSDL out of the JAR.</p><p>The following example shows some customization
options. By default, the codegen plugin follows the Maven convention of
"target/gen
erated-sources/cxf" for the output folder for the generated classes. You can
override this value using <sourceRoot> as shown below, but note this is
usually not necessary, the default is fine for most people and can make it
easier for some IDE's to detect the generated source code. Other configuration
arguments can be included inside the <wsdlOption> element. These pass
arguments to the tooling and correspond to the options outlined on the <a
shape="rect" href="wsdl-to-java.html">WSDL to Java</a> page.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;">...
+<pre class="brush: xml; gutter: false; theme: Default">...
<configuration>
<sourceRoot>${project.build.directory}/generated-code/mywebservice</sourceRoot>
<wsdlOptions>
@@ -158,7 +158,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
...
</pre>
</div></div><p>See <a shape="rect" class="external-link"
href="https://glenmazza.net/blog/entry/web-service-tutorial"
rel="nofollow">this blog entry</a> for a full service and client example that
uses the cxf-codegen-plugin.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example1:PassinginaJAX-WSBindingfile">Example
1: Passing in a JAX-WS Binding file</h3><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><configuration>
+<pre class="brush: xml; gutter: false; theme: Default"><configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/myService.wsdl</wsdl>
@@ -170,7 +170,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</configuration>
</pre>
</div></div><p>In this example we're specifying that we want CXF to use our
JAX-WS binding file. Binding files are a way to customize the output of the
artifacts that CXF generates. For instance, it allows you to change the package
name CXF uses.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example2:Specifythedatabinding">Example
2: Specify the data binding</h3><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><configuration>
+<pre class="brush: xml; gutter: false; theme: Default"><configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/myService.wsdl</wsdl>
@@ -183,7 +183,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</configuration>
</pre>
</div></div><p>In this example we're specifying that we want CXF to use our
data binding jibx. You can also using the data binding of xmlbeans, domsources,
sdo etc.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example3:Specifyingaservicetogenerateartifactsfor">Example
3: Specifying a service to generate artifacts for</h3><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><configuration>
+<pre class="brush: xml; gutter: false; theme: Default"><configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/myService.wsdl</wsdl>
@@ -193,7 +193,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</configuration>
</pre>
</div></div><p>In this example we're specifying that we only want to generate
artifacts for the service named "MyWSDLService" in the WSDL.</p><p>To avoid
copy/paste in multiple <wsdlOption> you can also declare a
<defaultOptions> element.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example4:UsingdefaultOptiontoavoidrepetition">Example
4: Using defaultOption to avoid repetition</h3><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><configuration>
+<pre class="brush: xml; gutter: false; theme: Default"><configuration>
<defaultOptions>
<bindingFiles>
<bindingFile>${basedir}/src/main/jaxb/bindings.xml</bindingFile>
@@ -213,7 +213,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</configuration>
</pre>
</div></div><p><defaultOptions> and <wsdlOption> correspond to the
options outlined on the <a shape="rect" href="wsdl-to-java.html">WSDL to
Java</a> page, you may look at <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/blob/master/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java"
rel="nofollow">https://github.com/apache/cxf/blob/master/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java</a>
for a more detailed description of those parameters.</p><p>At least, you can
declare a common wsdlRoot folder where you store your WSDL files and use
includes/excludes patterns to select the files to get used by the code
generator</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example5:UsingwsdlRootwithincludes/excludespatterns">Example
5: Using wsdlRoot with includes/excludes patterns</h3><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent pan
elContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><configuration>
+<pre class="brush: xml; gutter: false; theme: Default"><configuration>
<defaultOptions>
<bindingFiles>
<bindingFile>${basedir}/src/main/jaxb/bindings.xml</bindingFile>
@@ -227,7 +227,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</configuration>
</pre>
</div></div><p>wsdlRoot default value is <code>src/main/resources/wsdl</code>
so you may omit this declaration.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example6:Loadingawsdlfromthemavenrepository">Example
6: Loading a wsdl from the maven repository</h3><p>There is a
<wsdlArtifact> wsdlOption configuration which can be used to load a wsdl
file from the maven repository.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><configuration>
+<pre class="brush: xml; gutter: false; theme: Default"><configuration>
<wsdlOptions>
<wsdlOption>
<wsdlArtifact>
@@ -239,8 +239,8 @@ Apache CXF -- Maven cxf-codegen-plugin (
</wsdlOptions>
</configuration>
</pre>
-</div></div><p>This will load the wsdl
/org/apache/pizza/PizzaService-1.0.0.wsdl into your local maven repository and
generate java code from it.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example7:Usingxjcextensions">Example 7:
Using xjc extensions</h3><p>Standard JAXB command-line customizations can be
added via <extraarg> elements, either one per line or comma separated. <a
shape="rect" href="../xjc-utils.html">CXF also offers some JAXB extensions for
the code generation</a>. They have to be added as dependencies and then
activated by using an extraarg with content -xjc-X<extension id></p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>artifact id</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>description</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>extension id</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>cxf-xjc-boolean</p></td><td
colspan="1
" rowspan="1" class="confluenceTd"><p>Adds getters for booleans</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>cxf-xjc-bug671</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Workaroung for JAXB bug
671</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>bug671</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>cxf-xjc-dv</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Default value support</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>dv</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>cxf-xjc-ts</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Adds toString to objects</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>ts</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>cxf-xjc-wsdlextension</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>WsdlExtension support<
/p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>wsdlextension</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>jaxb-fluent-api</p><p>(<img class="emoticon
emoticon-warning"
src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/warning.png"
data-emoticon-name="warning" alt="(warning)"> not part of CXF:</p><p>group id
is net.java.dev.jaxb2-commons)</p></td><td colspan="1" rowspan="1"
class="confluenceTd">Fluent API for setters</td><td colspan="1" rowspan="1"
class="confluenceTd">fluent-api</td></tr></tbody></table></div><p>An example
showing attachment of a JAXB binding file and the CXF toString() extension is
below:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><plugin>
+</div></div><p>This will load the wsdl
/org/apache/pizza/PizzaService-1.0.0.wsdl into your local maven repository and
generate java code from it.</p><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example7:Usingxjcextensions">Example 7:
Using xjc extensions</h3><p>Standard JAXB command-line customizations can be
added via <extraarg> elements, either one per line or comma separated. <a
shape="rect" href="../xjc-utils.html">CXF also offers some JAXB extensions for
the code generation</a>. They have to be added as dependencies and then
activated by using an extraarg with content -xjc-X<extension id></p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>artifact id</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>description</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>extension id</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>cxf-xjc-boolean</p></td><td
colspan="1
" rowspan="1" class="confluenceTd"><p>Adds getters for booleans</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>cxf-xjc-bug671</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Workaroung for JAXB bug
671</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>bug671</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>cxf-xjc-dv</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Default value support</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>dv</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>cxf-xjc-ts</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Adds toString to objects</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>ts</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>cxf-xjc-wsdlextension</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>WsdlExtension support<
/p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>wsdlextension</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>jaxb-fluent-api</p><p>(<img class="emoticon
emoticon-warning"
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/warning.svg"
data-emoticon-name="warning" alt="(warning)"> not part of CXF:</p><p>group id
is net.java.dev.jaxb2-commons)</p></td><td colspan="1" rowspan="1"
class="confluenceTd">Fluent API for setters</td><td colspan="1" rowspan="1"
class="confluenceTd">fluent-api</td></tr></tbody></table></div><p>An example
showing attachment of a JAXB binding file and the CXF toString() extension is
below:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"><plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
@@ -273,13 +273,13 @@ Apache CXF -- Maven cxf-codegen-plugin (
</plugin>
</pre>
</div></div><p>In addition you need to add the cxf-xjc-runtime as a dependency
to your project:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
+<pre class="brush: xml; gutter: false; theme: Default"><dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
<version>${cxf-xjc.version}</version>
</dependency></pre>
</div></div><h3
id="Mavencxf-codegen-plugin(WSDLtoJava)-Example8-UsingJAXB/JAX-WS2.2withJava6">Example
8 - Using JAXB/JAX-WS 2.2 with Java 6</h3><p>Java 6 includes JAXB/JAX-WS 2.1
API's and a 2.1 implementations. However, sometimes it's desirable to use JAXB
or JAX-WS 2.2 instead to obtain various bug fixes and enhancements. Using 2.2
with Java 6 and Maven can be a bit tricky as it requires endorsing the API jars
which requires configuration of a bunch of plugins, requires use of "forking",
etc... First off, both Surefire and the Compiler plugins need to be setup to
point at an endorsed dir:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><pluginManagement>
+<pre class="brush: xml; gutter: false; theme: Default"><pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -302,7 +302,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</pluginManagement>
</pre>
</div></div><p>You will then need to use the maven-dependency-plugin to copy
the needed artifacts into the endorsed.dir:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><plugins>
+<pre class="brush: xml; gutter: false; theme: Default"><plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -334,7 +334,7 @@ Apache CXF -- Maven cxf-codegen-plugin (
</pre>
</div></div><p>Finally, you need to do similar setup for the CXF Codegen
plugin so it picks up the 2.2 API's and runtimes:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><plugin>
+<pre class="brush: xml; gutter: false; theme: Default"><plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>