< prev index next >

src/java.xml.ws/share/classes/javax/xml/ws/soap/AddressingFeature.java

Print this page




  35  * with any other binding is undefined.
  36  * <p>
  37  * This feature can be used during the creation of SEI proxy, and
  38  * {@link javax.xml.ws.Dispatch} instances on the client side and {@link Endpoint}
  39  * instances on the server side. This feature cannot be used for {@link Service}
  40  * instance creation on the client side.
  41  * <p>
  42  * The following describes the effects of this feature with respect
  43  * to be enabled or disabled:
  44  * <ul>
  45  *  <li> ENABLED: In this Mode, WS-Addressing will be enabled. It means
  46  *       the endpoint supports WS-Addressing but does not require its use.
  47  *       A sender could send messages with WS-Addressing headers or without
  48  *       WS-Addressing headers. But a receiver MUST consume both types of
  49  *       messages.
  50  *  <li> DISABLED: In this Mode, WS-Addressing will be disabled.
  51  *       At runtime, WS-Addressing headers MUST NOT be used by a sender or
  52  *       receiver.
  53  * </ul>
  54  * <p>
  55  * If the feature is enabled, the <code>required</code> property determines
  56  * whether the endpoint requires WS-Addressing. If it is set true,
  57  * WS-Addressing headers MUST be present on incoming and outgoing messages.
  58  * By default the <code>required</code> property is <code>false</code>.
  59  *
  60  * <p>
  61  * If the web service developer has not explicitly enabled this feature,
  62  * WSDL's wsam:Addressing policy assertion is used to find
  63  * the use of WS-Addressing. By using the feature explicitly, an application
  64  * overrides WSDL's indication of the use of WS-Addressing. In some cases,
  65  * this is really required. For example, if an application has implemented
  66  * WS-Addressing itself, it can use this feature to disable addressing. That
  67  * means a JAX-WS implementation doesn't consume or produce WS-Addressing
  68  * headers.
  69  *
  70  * <p>
  71  * If addressing is enabled, a corresponding wsam:Addressing policy assertion
  72  * must be generated in the WSDL as per
  73  * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicyassertions">
  74  * 3.1 WS-Policy Assertions</a>
  75  *
  76  * <p>
  77  * <b>Example 1: </b>Possible Policy Assertion in the generated WSDL for
  78  * <code>@Addressing</code>
  79  * <pre>
  80  *   &lt;wsam:Addressing wsp:Optional="true">
  81  *     &lt;wsp:Policy/>
  82  *   &lt;/wsam:Addressing>
  83  * </pre>
  84  *
  85  * <p>
  86  * <b>Example 2: </b>Possible Policy Assertion in the generated WSDL for
  87  * <code>@Addressing(required=true)</code>
  88  * <pre>
  89  *   &lt;wsam:Addressing>
  90  *     &lt;wsp:Policy/>
  91  *   &lt;/wsam:Addressing>
  92  * </pre>
  93  *
  94  * <p>
  95  * <b>Example 3: </b>Possible Policy Assertion in the generated WSDL for
  96  * <code>@Addressing(required=true, responses=Responses.ANONYMOUS)</code>
  97  * <pre>
  98  *   &lt;wsam:Addressing>
  99  *      &lt;wsp:Policy>
 100  *        &lt;wsam:AnonymousResponses/>
 101  *      &lt;/wsp:Policy>
 102  *   &lt;/wsam:Addressing>
 103  * </pre>
 104  *
 105  * <p>
 106  * See <a href="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/">
 107  * Web Services Addressing - Core</a>,
 108  * <a href="http://www.w3.org/TR/2006/REC-ws-addr-soap-20060509/">
 109  * Web Services Addressing 1.0 - SOAP Binding</a>,
 110  * and <a href="http://www.w3.org/TR/ws-addr-metadata/">
 111  * Web Services Addressing 1.0 - Metadata</a>
 112  * for more information on WS-Addressing.
 113  *
 114  * @see Addressing
 115  * @since 1.6, JAX-WS 2.1
 116  */
 117 
 118 public final class AddressingFeature extends WebServiceFeature {
 119     /**
 120      * Constant value identifying the AddressingFeature
 121      */
 122     public static final String ID = "http://www.w3.org/2005/08/addressing/module";


 164         ANONYMOUS,
 165 
 166         /**
 167          * Specifies the use of only non-anonymous
 168          * responses. It will result into
 169          * wsam:NonAnonymousResponses nested assertion as specified in
 170          * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicynonanonresponses">
 171          * 3.1.3 NonAnonymousResponses Assertion</a> in the generated WSDL.
 172          */
 173         NON_ANONYMOUS,
 174 
 175         /**
 176          * Supports all response types and this is the default
 177          */
 178         ALL
 179     }
 180 
 181     private final Responses responses;
 182 
 183     /**
 184      * Creates and configures an <code>AddressingFeature</code> with the
 185      * use of addressing requirements. The created feature enables
 186      * ws-addressing i.e. supports ws-addressing but doesn't require
 187      * its use. It is also configured to accept all the response types.
 188      */
 189     public AddressingFeature() {
 190         this(true, false, Responses.ALL);
 191     }
 192 
 193     /**
 194      * Creates and configures an <code>AddressingFeature</code> with the
 195      * use of addressing requirements. If <code>enabled</code> is true,
 196      * it enables ws-addressing i.e. supports ws-addressing but doesn't
 197      * require its use. It also configures to accept all the response types.
 198      *
 199      * @param enabled true enables ws-addressing i.e.ws-addressing
 200      * is supported but doesn't require its use
 201      */
 202     public AddressingFeature(boolean enabled) {
 203         this(enabled, false, Responses.ALL);
 204     }
 205 
 206     /**
 207      * Creates and configures an <code>AddressingFeature</code> with the
 208      * use of addressing requirements. If <code>enabled</code> and
 209      * <code>required</code> are true, it enables ws-addressing and
 210      * requires its use. It also configures to accept all the response types.
 211      *
 212      * @param enabled true enables ws-addressing i.e.ws-addressing
 213      * is supported but doesn't require its use
 214      * @param required true means requires the use of ws-addressing .
 215      */
 216     public AddressingFeature(boolean enabled, boolean required) {
 217         this(enabled, required, Responses.ALL);
 218     }
 219 
 220     /**
 221      * Creates and configures an <code>AddressingFeature</code> with the
 222      * use of addressing requirements. If <code>enabled</code> and
 223      * <code>required</code> are true, it enables ws-addressing and
 224      * requires its use. Also, the response types can be configured using
 225      * <code>responses</code> parameter.
 226      *
 227      * @param enabled true enables ws-addressing i.e.ws-addressing
 228      * is supported but doesn't require its use
 229      * @param required true means requires the use of ws-addressing .
 230      * @param responses specifies what type of responses are required
 231      *
 232      * @since 1.7, JAX-WS 2.2
 233      */
 234     public AddressingFeature(boolean enabled, boolean required, Responses responses) {
 235         this.enabled = enabled;
 236         this.required = required;
 237         this.responses = responses;
 238     }
 239 
 240     /**
 241      * {@inheritDoc}
 242      */
 243     public String getID() {
 244         return ID;
 245     }
 246 
 247     /**
 248      * If addressing is enabled, this property determines whether the endpoint
 249      * requires WS-Addressing. If required is true, WS-Addressing headers MUST
 250      * be present on incoming and outgoing messages.
 251      *
 252      * @return the current required value
 253      */
 254     public boolean isRequired() {
 255         return required;
 256     }
 257 
 258     /**
 259      * If addressing is enabled, this property determines whether endpoint
 260      * requires the use of anonymous responses, or non-anonymous responses,
 261      * or all responses.
 262      *
 263      * <p>
 264      * @return {@link Responses#ALL} when endpoint supports all types of
 265      * responses,
 266      *         {@link Responses#ANONYMOUS} when endpoint requires the use of
 267      * only anonymous responses,
 268      *         {@link Responses#NON_ANONYMOUS} when endpoint requires the use
 269      * of only non-anonymous responses
 270      *
 271      * @since 1.7, JAX-WS 2.2
 272      */
 273     public Responses getResponses() {
 274         return responses;
 275     }
 276 
 277 }


  35  * with any other binding is undefined.
  36  * <p>
  37  * This feature can be used during the creation of SEI proxy, and
  38  * {@link javax.xml.ws.Dispatch} instances on the client side and {@link Endpoint}
  39  * instances on the server side. This feature cannot be used for {@link Service}
  40  * instance creation on the client side.
  41  * <p>
  42  * The following describes the effects of this feature with respect
  43  * to be enabled or disabled:
  44  * <ul>
  45  *  <li> ENABLED: In this Mode, WS-Addressing will be enabled. It means
  46  *       the endpoint supports WS-Addressing but does not require its use.
  47  *       A sender could send messages with WS-Addressing headers or without
  48  *       WS-Addressing headers. But a receiver MUST consume both types of
  49  *       messages.
  50  *  <li> DISABLED: In this Mode, WS-Addressing will be disabled.
  51  *       At runtime, WS-Addressing headers MUST NOT be used by a sender or
  52  *       receiver.
  53  * </ul>
  54  * <p>
  55  * If the feature is enabled, the {@code required} property determines
  56  * whether the endpoint requires WS-Addressing. If it is set true,
  57  * WS-Addressing headers MUST be present on incoming and outgoing messages.
  58  * By default the {@code required} property is {@code false}.
  59  *
  60  * <p>
  61  * If the web service developer has not explicitly enabled this feature,
  62  * WSDL's wsam:Addressing policy assertion is used to find
  63  * the use of WS-Addressing. By using the feature explicitly, an application
  64  * overrides WSDL's indication of the use of WS-Addressing. In some cases,
  65  * this is really required. For example, if an application has implemented
  66  * WS-Addressing itself, it can use this feature to disable addressing. That
  67  * means a JAX-WS implementation doesn't consume or produce WS-Addressing
  68  * headers.
  69  *
  70  * <p>
  71  * If addressing is enabled, a corresponding wsam:Addressing policy assertion
  72  * must be generated in the WSDL as per
  73  * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicyassertions">
  74  * 3.1 WS-Policy Assertions</a>
  75  *
  76  * <p>
  77  * <b>Example 1: </b>Possible Policy Assertion in the generated WSDL for
  78  * {@code @Addressing}
  79  * <pre> {@code
  80  *   <wsam:Addressing wsp:Optional="true">
  81  *     <wsp:Policy/>
  82  *   </wsam:Addressing> }
  83  * </pre>
  84  *
  85  * <p>
  86  * <b>Example 2: </b>Possible Policy Assertion in the generated WSDL for
  87  * {@code @Addressing(required=true)}
  88  * <pre> {@code
  89  *   <wsam:Addressing>
  90  *     <wsp:Policy/>
  91  *   </wsam:Addressing> }
  92  * </pre>
  93  *
  94  * <p>
  95  * <b>Example 3: </b>Possible Policy Assertion in the generated WSDL for
  96  * {@code @Addressing(required=true, responses=Responses.ANONYMOUS)}
  97  * <pre> {@code
  98  *   <wsam:Addressing>
  99  *      <wsp:Policy>
 100  *        <wsam:AnonymousResponses/>
 101  *      </wsp:Policy>
 102  *   </wsam:Addressing> }
 103  * </pre>
 104  *
 105  * <p>
 106  * See <a href="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/">
 107  * Web Services Addressing - Core</a>,
 108  * <a href="http://www.w3.org/TR/2006/REC-ws-addr-soap-20060509/">
 109  * Web Services Addressing 1.0 - SOAP Binding</a>,
 110  * and <a href="http://www.w3.org/TR/ws-addr-metadata/">
 111  * Web Services Addressing 1.0 - Metadata</a>
 112  * for more information on WS-Addressing.
 113  *
 114  * @see Addressing
 115  * @since 1.6, JAX-WS 2.1
 116  */
 117 
 118 public final class AddressingFeature extends WebServiceFeature {
 119     /**
 120      * Constant value identifying the AddressingFeature
 121      */
 122     public static final String ID = "http://www.w3.org/2005/08/addressing/module";


 164         ANONYMOUS,
 165 
 166         /**
 167          * Specifies the use of only non-anonymous
 168          * responses. It will result into
 169          * wsam:NonAnonymousResponses nested assertion as specified in
 170          * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicynonanonresponses">
 171          * 3.1.3 NonAnonymousResponses Assertion</a> in the generated WSDL.
 172          */
 173         NON_ANONYMOUS,
 174 
 175         /**
 176          * Supports all response types and this is the default
 177          */
 178         ALL
 179     }
 180 
 181     private final Responses responses;
 182 
 183     /**
 184      * Creates and configures an {@code AddressingFeature} with the
 185      * use of addressing requirements. The created feature enables
 186      * ws-addressing i.e. supports ws-addressing but doesn't require
 187      * its use. It is also configured to accept all the response types.
 188      */
 189     public AddressingFeature() {
 190         this(true, false, Responses.ALL);
 191     }
 192 
 193     /**
 194      * Creates and configures an {@code AddressingFeature} with the
 195      * use of addressing requirements. If {@code enabled} is true,
 196      * it enables ws-addressing i.e. supports ws-addressing but doesn't
 197      * require its use. It also configures to accept all the response types.
 198      *
 199      * @param enabled true enables ws-addressing i.e.ws-addressing
 200      * is supported but doesn't require its use
 201      */
 202     public AddressingFeature(boolean enabled) {
 203         this(enabled, false, Responses.ALL);
 204     }
 205 
 206     /**
 207      * Creates and configures an {@code AddressingFeature} with the
 208      * use of addressing requirements. If {@code enabled} and
 209      * {@code required} are true, it enables ws-addressing and
 210      * requires its use. It also configures to accept all the response types.
 211      *
 212      * @param enabled true enables ws-addressing i.e.ws-addressing
 213      * is supported but doesn't require its use
 214      * @param required true means requires the use of ws-addressing .
 215      */
 216     public AddressingFeature(boolean enabled, boolean required) {
 217         this(enabled, required, Responses.ALL);
 218     }
 219 
 220     /**
 221      * Creates and configures an {@code AddressingFeature} with the
 222      * use of addressing requirements. If {@code enabled} and
 223      * {@code required} are true, it enables ws-addressing and
 224      * requires its use. Also, the response types can be configured using
 225      * {@code responses} parameter.
 226      *
 227      * @param enabled true enables ws-addressing i.e.ws-addressing
 228      * is supported but doesn't require its use
 229      * @param required true means requires the use of ws-addressing .
 230      * @param responses specifies what type of responses are required
 231      *
 232      * @since 1.7, JAX-WS 2.2
 233      */
 234     public AddressingFeature(boolean enabled, boolean required, Responses responses) {
 235         this.enabled = enabled;
 236         this.required = required;
 237         this.responses = responses;
 238     }
 239 
 240     /**
 241      * {@inheritDoc}
 242      */
 243     public String getID() {
 244         return ID;
 245     }
 246 
 247     /**
 248      * If addressing is enabled, this property determines whether the endpoint
 249      * requires WS-Addressing. If required is true, WS-Addressing headers MUST
 250      * be present on incoming and outgoing messages.
 251      *
 252      * @return the current required value
 253      */
 254     public boolean isRequired() {
 255         return required;
 256     }
 257 
 258     /**
 259      * If addressing is enabled, this property determines whether endpoint
 260      * requires the use of anonymous responses, or non-anonymous responses,
 261      * or all responses.
 262      *

 263      * @return {@link Responses#ALL} when endpoint supports all types of
 264      * responses,
 265      *         {@link Responses#ANONYMOUS} when endpoint requires the use of
 266      * only anonymous responses,
 267      *         {@link Responses#NON_ANONYMOUS} when endpoint requires the use
 268      * of only non-anonymous responses
 269      *
 270      * @since 1.7, JAX-WS 2.2
 271      */
 272     public Responses getResponses() {
 273         return responses;
 274     }
 275 
 276 }
< prev index next >