Author: buildbot
Date: Sat Sep 21 16:42:52 2024
New Revision: 1087602
Log:
Production update by buildbot for cxf
Modified:
websites/production/cxf/content/cache/docs.pageCache
websites/production/cxf/content/docs/wsdl-to-java.html
Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/cxf/content/docs/wsdl-to-java.html
==============================================================================
--- websites/production/cxf/content/docs/wsdl-to-java.html (original)
+++ websites/production/cxf/content/docs/wsdl-to-java.html Sat Sep 21 16:42:52
2024
@@ -149,7 +149,11 @@ Apache CXF -- WSDL to Java
</target>
</project>
</pre>
-</div></div><p>Make sure you set the "fork=true" attribute for the
<java/> task as shown above. Also, remember to keep each word or flag
within the command line options in its own <arg/> element (e.g., do not
use <arg value="-d src"/>, but split them up into two <arg/>
elements as done here.)</p><p>Although we would recommend using Maven, see the
<a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/antbuild"
rel="nofollow">antbuild sample</a> in the CXF distribution for an example of
using Ant to create a CXF project.</p><h2
id="WSDLtoJava-JAXWSCustomization">JAXWS Customization</h2><p>The default
JAX-WS frontend created by wsdl2java can be customized by using a customization
binding file. For an example, see the <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jaxws_async/wsdl/async_binding.xml"
rel="nofollow">asyn
c_binding.xml</a> file in samples/jaxws_async – if specified when
running wsdl2java, it will generate asynchronous methods in the
SEI.</p><p><strong>Q: What if I want to change the generated SEI
name?</strong></p><p>A: We don't have a command-line option to do this, but you
can have a binding file like the following snippet to achieve this goal</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><p>Make sure you set the "fork=true" attribute for the
<java/> task as shown above. Also, remember to keep each word or flag
within the command line options in its own <arg/> element (e.g., do not
use <arg value="-d src"/>, but split them up into two <arg/>
elements as done here.)</p><p>Although we would recommend using Maven, see the
<a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/antbuild"
rel="nofollow">antbuild sample</a> in the CXF distribution for an example of
using Ant to create a CXF project.</p><h2
id="WSDLtoJava-JAXWSCustomization">JAXWS Customization</h2><p>The default
JAX-WS frontend created by wsdl2java can be customized by using a customization
binding file. For an example, see the <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jaxws_async/wsdl/async_binding.xml"
rel="nofollow">asyn
c_binding.xml</a> file in samples/jaxws_async – if specified when
running wsdl2java, it will generate asynchronous methods in the
SEI.</p><p><strong>Q: What if I want to change the generated SEI
name?</strong></p><p>A: We don't have a command-line option to do this, but you
can have a binding file like the following snippet to achieve this goal</p>
+<div class="contentf aui-tabs horizontal-tabs">
+ <ul class="tabs-menu"></ul>
+ <div class="cfm tabs-pane" id="3.6.x" data-pane-title="3.6.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
@@ -158,9 +162,32 @@ Apache CXF -- WSDL to Java
<bindings node="wsdl:definitions/wsdl:portType[@name='GreeterSE']">
<class name="GreeterSEI"/>
</bindings>
-</bindings>
-</pre>
-</div></div><p><strong>Q: How do I pass the binding file to
wsdl2java?</strong></p><p>A: If you are using wsdl2java via command line
tool:</p><p>wsdl2java HelloWorld.wsdl -b my_binding.xml</p><p>For Ant, follow
the example above on how to add "-b" and "my_binding.xml" as arg
elements.</p><p>For Maven see <a shape="rect"
href="maven-cxf-codegen-plugin-wsdl-to-java.html">cxf-codegen-plugin</a></p><p><strong>Q:
How to map xsd:dateTime to java.util.Date?</strong><br clear="none">Well,
people don't like the XMLGregorianCalendar which is the default mapping from
the xsd:dateTime (xsd:time and xsd:date as well),<br clear="none">We can use
the jaxws customization to change the default mapping, here are some sample
binding files<br clear="none">If you have schema inside the wsdl, here is the
binding file you can use:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</bindings></pre>
+</div></div>
+
+
+</div>
+<div class="cfm tabs-pane" id="4.0.x" data-pane-title="4.0.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"><bindings
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ wsdlLocation="hello_world.wsdl"
+ xmlns="https://jakarta.ee/xml/ns/jaxws">
+ <bindings node="wsdl:definitions/wsdl:portType[@name='GreeterSE']">
+ <class name="GreeterSEI"/>
+ </bindings>
+</bindings></pre>
+</div></div>
+
+
+</div>
+</div>
+<p><strong>Q: How do I pass the binding file to wsdl2java?</strong></p><p>A:
If you are using wsdl2java via command line tool:</p><p>wsdl2java
HelloWorld.wsdl -b my_binding.xml</p><p>For Ant, follow the example above on
how to add "-b" and "my_binding.xml" as arg elements.</p><p>For Maven see <a
shape="rect"
href="maven-cxf-codegen-plugin-wsdl-to-java.html">cxf-codegen-plugin</a></p><p><strong>Q:
How to map xsd:dateTime to java.util.Date?</strong><br clear="none">Well,
people don't like the XMLGregorianCalendar which is the default mapping from
the xsd:dateTime (xsd:time and xsd:date as well),<br clear="none">We can use
the jaxws customization to change the default mapping, here are some sample
binding files<br clear="none">If you have schema inside the wsdl, here is the
binding file you can use:</p>
+<div class="contentf aui-tabs horizontal-tabs">
+ <ul class="tabs-menu"></ul>
+ <div class="cfm tabs-pane" id="3.6.x" data-pane-title="3.6.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><jaxws:bindings
wsdlLocation="YOUR_WSDL_LOCATION"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
@@ -173,15 +200,42 @@ Apache CXF -- WSDL to Java
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDateTime"/>
</jxb:globalBindings>
</jaxws:bindings>
-</jaxws:bindings>
-</pre>
-</div></div><p>This requires an additional dependency:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</jaxws:bindings></pre>
+</div></div>
+
+
+</div>
+<div class="cfm tabs-pane" id="4.0.x" data-pane-title="4.0.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"><jaxws:bindings
wsdlLocation="YOUR_WSDL_LOCATION"
+ xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <jaxws:bindings
node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='THE_NAMESPACE_OF_YOUR_SCHEMA']">
+ <jxb:globalBindings xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
+
parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseDateTime"
+
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDateTime"/>
+ </jxb:globalBindings>
+ </jaxws:bindings>
+</jaxws:bindings></pre>
+</div></div>
+
+
+</div>
+</div>
+<p><br clear="none"></p><p>This requires an additional dependency:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
</dependency>
</pre>
-</div></div><p><br clear="none"></p><p>If you want to use java.util.Calendar,
just change the org.apache.cxf.xjc.runtime.DataTypeAdapter to
javax.xml.bind.DatatypeConverter, and change the name value to
"java.util.Calendar"</p><p>If your schema is out of wsdl, here is an example
you can try:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><p><br clear="none"></p><p>If you want to use java.util.Calendar,
just change the org.apache.cxf.xjc.runtime.DataTypeAdapter to
javax.xml.bind.DatatypeConverter, and change the name value to
"java.util.Calendar"</p><p>If your schema is out of wsdl, here is an example
you can try:</p>
+<div class="contentf aui-tabs horizontal-tabs">
+ <ul class="tabs-menu"></ul>
+ <div class="cfm tabs-pane" id="3.6.x" data-pane-title="3.6.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><jxb:bindings
version="2.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
@@ -192,9 +246,34 @@ Apache CXF -- WSDL to Java
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDateTime"/>
</jxb:globalBindings>
</jxb:bindings>
-</jxb:bindings>
-</pre>
-</div></div><p><span class="confluence-anchor-link"
id="WSDLtoJava-wrapperstyle"></span><br clear="none"><strong>Q: How can I
switch my generated web service method calls from wrapper style to non
wrapper-style (or vice-versa)?</strong></p><p>A: Create an external binding
file and set the value of <enableWrapperStyle/> to true or false as
desired:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</jxb:bindings></pre>
+</div></div>
+
+
+</div>
+<div class="cfm tabs-pane" id="4.0.x" data-pane-title="4.0.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"><jxb:bindings
version="3.0"
+ xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <jxb:bindings schemaLocation="file:<path><name>.xsd"
node="/xs:schema">
+ <jxb:globalBindings xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
+
parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseDateTime"
+
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDateTime"/>
+ </jxb:globalBindings>
+ </jxb:bindings>
+</jxb:bindings></pre>
+</div></div>
+
+
+</div>
+</div>
+<p><br clear="none"></p><p><span class="confluence-anchor-link"
id="WSDLtoJava-wrapperstyle"></span><br clear="none"><strong>Q: How can I
switch my generated web service method calls from wrapper style to non
wrapper-style (or vice-versa)?</strong></p><p>A: Create an external binding
file and set the value of <enableWrapperStyle/> to true or false as
desired:</p>
+<div class="contentf aui-tabs horizontal-tabs">
+ <ul class="tabs-menu"></ul>
+ <div class="cfm tabs-pane" id="3.6.x" data-pane-title="3.6.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><jaxws:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
@@ -202,9 +281,31 @@ Apache CXF -- WSDL to Java
xmlns="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<enableWrapperStyle>false</enableWrapperStyle>
-</jaxws:bindings>
-</pre>
-</div></div><p>Alternatively you can embed this instruction within the WSDL
file directly, as the immediate child of the wsdl:portType:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</jaxws:bindings> </pre>
+</div></div>
+
+
+</div>
+<div class="cfm tabs-pane" id="4.0.x" data-pane-title="4.0.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"><jaxws:bindings
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ wsdlLocation="your.wsdl"
+ xmlns="https://jakarta.ee/xml/ns/jaxws"
+ xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws">
+ <enableWrapperStyle>false</enableWrapperStyle>
+</jaxws:bindings> </pre>
+</div></div>
+
+
+</div>
+</div>
+<p><br clear="none"></p><p>Alternatively you can embed this instruction within
the WSDL file directly, as the immediate child of the wsdl:portType:</p>
+<div class="contentf aui-tabs horizontal-tabs">
+ <ul class="tabs-menu"></ul>
+ <div class="cfm tabs-pane" id="3.6.x" data-pane-title="3.6.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><wsdl:portType
name="MyWebServicePortType">
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
@@ -214,7 +315,26 @@ Apache CXF -- WSDL to Java
...
</wsdl:portType>
</pre>
-</div></div><p>Note: The meaning of "wrapper-style" and "non-wrapper style" as
defined in the <a shape="rect" class="external-link"
href="http://jcp.org/aboutJava/communityprocess/pfd/jsr224/index.html"
rel="nofollow">JAX-WS 2.1 specification</a> can be counterintuitive.
Wrapper-style indicates that each data element within the request message gets
its own Java parameter, while non-wrapper style means that a single Java object
containing all the data elements serves as the lone parameter to the web
service method call. (See Figure 2.2 of the specification for an example.)
Also, <strong>note the wrapper style is not always available</strong>, the WSDL
criteria specified in Section 2.3.1.2 ("Wrapper Style") of the specification
must be met or only non-wrapper style will be generated.</p><p><strong>Q: What
else can I change with the JAXWS customization binding file?</strong></p><p>A:
You can find the full list of customization items in Chapter 8 of the JAX-WS
Specification.</p><p><span
class="confluence-anchor-link" id="WSDLtoJava-usingmaven"></span></p><h2
id="WSDLtoJava-UsingmaventogeneratejavacodefromWSDL">Using maven to generate
java code from WSDL</h2><p>see <a shape="rect"
href="maven-cxf-codegen-plugin-wsdl-to-java.html">cxf-codegen-plugin</a></p><h3
id="WSDLtoJava-SeeAlso">See Also</h3><p><a shape="rect"
href="idl-to-wsdl.html"><code>idl2wsdl</code></a>, <a shape="rect"
href="java-to-javascript.html"><code>java2js</code></a>, <a shape="rect"
href="java-to-ws.html"><code>java2ws</code></a>, <a shape="rect"
href="wsdl-to-corba.html"><code>wsdl2corba</code></a>, <a shape="rect"
href="wsdl-to-javascript.html"><code>wsdl2js</code></a>, <a shape="rect"
href="wsdl-to-service.html"><code>wsdl2service</code></a>, <a shape="rect"
href="wsdl-to-soap.html"><code>wsdl2soap</code></a>, <a shape="rect"
href="wsdl-to-xml.html"><code>wsdl2xml</code></a>, <a shape="rect"
href="wsdlvalidator.html"><code>wsdlvalidator</code></a> and <a shape="rect"
href="xsd-to-wsdl.html">xs
d2wsdl</a>.</p></div>
+</div></div>
+
+
+</div>
+<div class="cfm tabs-pane" id="4.0.x" data-pane-title="4.0.x">
+ <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"><wsdl:portType
name="MyWebServicePortType">
+ <jaxws:bindings xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws">
+ <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
+ ... other binding settings if needed ...
+ </jaxws:bindings>
+ <wsdl:operation name="sayHello">
+ ...
+</wsdl:portType></pre>
+</div></div>
+
+
+</div>
+</div>
+<p>Note: The meaning of "wrapper-style" and "non-wrapper style" as defined in
the <a shape="rect" class="external-link"
href="http://jcp.org/aboutJava/communityprocess/pfd/jsr224/index.html"
rel="nofollow">JAX-WS 2.1 specification</a> can be counterintuitive.
Wrapper-style indicates that each data element within the request message gets
its own Java parameter, while non-wrapper style means that a single Java object
containing all the data elements serves as the lone parameter to the web
service method call. (See Figure 2.2 of the specification for an example.)
Also, <strong>note the wrapper style is not always available</strong>, the WSDL
criteria specified in Section 2.3.1.2 ("Wrapper Style") of the specification
must be met or only non-wrapper style will be generated.</p><p><strong>Q: What
else can I change with the JAXWS customization binding file?</strong></p><p>A:
You can find the full list of customization items in Chapter 8 of the JAX-WS
Specification.</p><p><span class="conf
luence-anchor-link" id="WSDLtoJava-usingmaven"></span></p><h2
id="WSDLtoJava-UsingmaventogeneratejavacodefromWSDL">Using maven to generate
java code from WSDL</h2><p>see <a shape="rect"
href="maven-cxf-codegen-plugin-wsdl-to-java.html">cxf-codegen-plugin</a></p><h3
id="WSDLtoJava-SeeAlso">See Also</h3><p><a shape="rect"
href="idl-to-wsdl.html"><code>idl2wsdl</code></a>, <a shape="rect"
href="java-to-javascript.html"><code>java2js</code></a>, <a shape="rect"
href="java-to-ws.html"><code>java2ws</code></a>, <a shape="rect"
href="wsdl-to-corba.html"><code>wsdl2corba</code></a>, <a shape="rect"
href="wsdl-to-javascript.html"><code>wsdl2js</code></a>, <a shape="rect"
href="wsdl-to-service.html"><code>wsdl2service</code></a>, <a shape="rect"
href="wsdl-to-soap.html"><code>wsdl2soap</code></a>, <a shape="rect"
href="wsdl-to-xml.html"><code>wsdl2xml</code></a>, <a shape="rect"
href="wsdlvalidator.html"><code>wsdlvalidator</code></a> and <a shape="rect"
href="xsd-to-wsdl.html">xsd2wsdl</a>.<
/p></div>
</div>
<!-- Content -->
</td>