KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > ws > soap > AddressingFeature


1 /*
2  * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */

5
6 package javax.xml.ws.soap;
7
8 import javax.xml.ws.Action;
9 import javax.xml.ws.BindingProvider;
10 import javax.xml.ws.FaultAction;
11 import javax.xml.ws.WebServiceFeature;
12 import javax.xml.ws.WebServiceException;
13 import javax.xml.ws.spi.Provider;
14
15 /**
16  * This feature represents the use of WS-Addressing with either
17  * the SOAP 1.1/HTTP or SOAP 1.2/HTTP binding. Using this feature
18  * with any other binding is NOT required.
19  * <p>
20  * Enabling this feature on the client will cause the JAX-WS runtime
21  * to include WS-Addressing headers in SOAP messages.
22  * <p>
23  * If the web service developer has not explicitly enabled this feature,
24  * it MAY be automatically enabled if the associated WSDL enables
25  * WS-Addressing with an implementation recognized WSDL extension element.
26  * However, in this version of JAX-WS, there is no standard WSDL
27  * extension that a client can rely on to automatically enable WS-Addressing,
28  * nor is there a standard default value specified for WS-Addressing
29  * <code>Action</code> headers.
30  * <p>
31  * To write a portable endpoint and its corresponding client with this
32  * version of JAX-WS, an endpoint MUST explicitly specify what WS-Addressing
33  * <code>Actions</code> are to be used via the {@link Action} and
34  * {@link FaultAction} annotations. The client MUST explicitly enable
35  * addresssing via this <code>AddressingFeature</code>, and for each invocation,
36  * the client MUST explicitly set the {@link BindingProvider#SOAPACTION_URI_PROPERTY}.
37  * After the W3C WG on WS-Addressing has specified how the use of WS-Addressing
38  * is specified in the WSDL, and what the default value must be for Action headers,
39  * a future version of JAX-WS will remove these requirements.
40  * <p>
41  * See {@link javax.xml.ws.RespectBindingFeature} for more information
42  * on required WSDL extensions.
43  * <p>
44  * The following describes the effects of this feature with respect
45  * to be enabled or disabled:
46  * <ul>
47  * <li> ENABLED: In this Mode, WS-Addressing will be enabled.
48  * At runtime, WS-Addressing headers
49  * MUST be consumed by the receiver and produced by the
50  * sender even if the WSDL declares otherwise. The
51  * mustUnderstand="0" attribute MUST be used on the WS-Addressing
52  * headers.
53  * <li> DISABLED: In this Mode, WS-Addressing will be disabled
54  * even if an associated WSDL specifies otherwise. At runtime,
55  * WS-Addressing headers MUST NOT be used. WS-Addressing may be explicitly
56  * disabled to prevent a JAX-WS implementation from consuming and producing
57  * WS-Addressing headers. If an application
58  * has implemented WS-Addressing itself, it MUST explicitly disable this feature.
59 * Not doing so may break compatibility with future versions of JAX-WS.
60  * </ul>
61  * <p>
62  * The {@link #required} property can be used to
63  * specify if WS-Addressing headers MUST be present
64  * on incoming messages. This property only has meaning when used on the
65  * endpoint and has no affect when used on the client.
66  * By default the
67  * <code>required</code> property is <code>false</code>.
68   <p>
69
70  * See <a HREF="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/">Web Services Addressing - Core</a>
71  * and <a HREF="http://www.w3.org/TR/2006/REC-ws-addr-soap-20060509/">Web Services Addressing 1.0 - SOAP Binding</a>
72  * for more information on WS-Addressing.
73  *
74  * @since JAX-WS 2.1
75  */

76 public final class AddressingFeature extends WebServiceFeature {
77     /**
78      * Constant value identifying the AddressingFeature
79      */

80     public static final String JavaDoc ID = "http://www.w3.org/2005/08/addressing/module";
81   
82     /**
83      * Property for the <code>required</code> feature parameter. When WS-Addressing
84      * is enabled, the value of this property will be used
85      * to specify if WS-Addressing headers MUST be present on incoming messages. This
86      * property only has meaning on the endpoint and has no
87      * affect when used on the client.
88      */

89     protected boolean required = false;
90     
91     /**
92      * Create an <code>AddressingFeature</code>.
93      * The instance created will be enabled.
94      */

95     public AddressingFeature() {
96         this.enabled = true;
97     }
98     
99     /**
100      * Create an <code>AddressingFeature</code>
101      *
102      * @param enabled specifies whether this feature should
103      * be enabled or not.
104      */

105     public AddressingFeature(boolean enabled) {
106         this.enabled = enabled;
107     }
108
109     /**
110      * Create an <code>AddressingFeature</code>
111      *
112      * @param enabled specifies whether this feature should
113      * be enabled or not.
114      * @param required specifies whether
115      * WS-Addressing headers MUST be present on incoming messages. This property
116      * only has meaning on the endpoint and has no affect when
117      * used on the client.
118      */

119     public AddressingFeature(boolean enabled, boolean required) {
120         this.enabled = enabled;
121         this.required = required;
122     }
123     
124     /**
125      * {@inheritDoc}
126      */

127     public String JavaDoc getID() {
128         return ID;
129     }
130     
131     /**
132      * Gets the boolean value used to determine if WS-Addressing
133      * headers MUST be present on incoming messages. This property
134      * only has meaning on the endpoint, and has no affect
135      * when used on the client.
136      *
137      * @return the current required value
138      */

139     public boolean isRequired() {
140         return required;
141     }
142 }
143
Popular Tags