View Javadoc
1   /*
2    * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package javax.xml.ws;
27  
28  import javax.xml.ws.soap.AddressingFeature;
29  
30  /**
31   * This feature clarifies the use of the <code>wsdl:binding</code>
32   * in a JAX-WS runtime.
33   *
34   * This feature can be used during the creation of SEI proxy, and
35   * {@link Dispatch} instances on the client side and {@link Endpoint}
36   * instances on the server side. This feature cannot be used for {@link Service}
37   * instance creation on the client side.
38   * <p>
39   * This feature is only useful with web services that have an
40   * associated WSDL. Enabling this feature requires that a JAX-WS
41   * implementation inspect the <code>wsdl:binding</code> for an
42   * endpoint at runtime to make sure that all <code>wsdl:extensions</code>
43   * that have the <code>required</code> attribute set to <code>true</code>
44   * are understood and are being used.
45   * <p>
46   * The following describes the affects of this feature with respect
47   * to be enabled or disabled:
48   * <ul>
49   *  <li> ENABLED: In this Mode, a JAX-WS runtime MUST assure that all
50   *  required <code>wsdl:binding</code> extensions(including policies) are
51   *  either understood and used by the runtime, or explicitly disabled by the
52   *  web service application. A web service can disable a particular
53   *  extension if there is a corresponding {@link WebServiceFeature} or annotation.
54   *  Similarly, a web service client can disable
55   *  particular extension using the corresponding <code>WebServiceFeature</code> while
56   *  creating a proxy or Dispatch instance.
57   *  The runtime MUST also make sure that binding of
58   *  SEI parameters/return values respect the <code>wsdl:binding</code>.
59   *  With this feature enabled, if a required (<code>wsdl:required="true"</code>)
60   *  <code>wsdl:binding</code> extension is in the WSDL and it is not
61   *  supported by a JAX-WS runtime and it has not
62   *  been explicitly turned off by the web service developer, then
63   *  that JAX-WS runtime MUST behave appropriately based on whether it is
64   *  on the client or server:
65   *  <UL>
66   *    <li>Client: runtime MUST throw a
67   *  {@link WebServiceException} no sooner than when one of the methods
68   *  above is invoked but no later than the first invocation of an endpoint
69   *  operation.
70   *    <li>Server: throw a {@link WebServiceException} and the endpoint MUST fail to deploy
71   *  </ul>
72   *
73   *  <li> DISABLED: In this Mode, an implementation may choose whether
74   *  to inspect the <code>wsdl:binding</code> or not and to what degree
75   *  the <code>wsdl:binding</code> will be inspected.  For example,
76   *  one implementation may choose to behave as if this feature is enabled,
77   *  another implementation may only choose to verify the SEI's
78   *  parameter/return type bindings.
79   * </ul>
80   *
81   * @see AddressingFeature
82   *
83   * @since JAX-WS 2.1
84   */
85  public final class RespectBindingFeature extends WebServiceFeature {
86      /**
87       *
88       * Constant value identifying the RespectBindingFeature
89       */
90      public static final String ID = "javax.xml.ws.RespectBindingFeature";
91  
92  
93      /**
94       * Creates an <code>RespectBindingFeature</code>.
95       * The instance created will be enabled.
96       */
97      public RespectBindingFeature() {
98          this.enabled = true;
99      }
100 
101     /**
102      * Creates an RespectBindingFeature
103      *
104      * @param enabled specifies whether this feature should
105      * be enabled or not.
106      */
107     public RespectBindingFeature(boolean enabled) {
108         this.enabled = enabled;
109     }
110 
111     /**
112      * {@inheritDoc}
113      */
114     public String getID() {
115         return ID;
116     }
117 }