Java Reference
In-Depth Information
Either way, you enable these options by specifying simple values for these elements, which
are defined within the http://java.sun.com/xml/ns/jaxws namespace, and use a prefix of
JAX-WS by convention. Regardless of method (inline or file), the element JAX-WS:bindings
is used to contain all other binding declarations. You can specify the declarations in any order.
But each of the standard custom bindings is allowed only in certain places. If you are using an
external file, you must specify the proper node using XPath on the bindings @node attribute.
If you specify bindings inline within the WSDL, you must take care to place the bindings only
on the elements to which you want them to apply (and on which they are allowed to apply) or
you will get a deployment error, rendering your service unavailable.
NOTE
If you are using bindings within a WSDL document, you cannot use either the @node or the
@wsdlLocation element.
The following sections discuss the use of these two methods.
Using the external binding file
With this approach, you group all binding declarations for your WSDL into a single document,
which is a standalone file. You write the jaxws:bindings element, and specify a value for the
wsdlLocation property to indicate what WSDL this binding applies to. You also supply an
XPath expression to the node property to signal what aspect of the WSDL this binding applies
to. A standalone binding file that enables asynchronous operations is shown in Example 7-8 .
Example7-8.Standalone file with JAX-WS binding customizations
<jaxws:bindings wsdlLocation="http://ns.soacookbook.com/
Calculator.wsdl">
<jaxws:packageName="com.soacookbook.calc">
<jaxws:javadoc>The 'add' operations in this package will be
available asynchronously.
</jaxws:javadoc>
</jaxws:packageName>
<jaxws:bindings node="wsdl:operation[@name='add']">
<jaxws:enableAsyncMapping>true</jaxws:enableAsyncMapping>
</jaxws:bindings>
<jaxws:bindings>
This file applies to the single WSDL at the given location, and it specifies two binding cus-
tomizations. The first is that the package name specified will contain the JavaDoc of the given
Search WWH ::




Custom Search