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 java.lang.annotation.Documented; 29 import java.lang.annotation.ElementType; 30 import java.lang.annotation.Retention; 31 import java.lang.annotation.RetentionPolicy; 32 import java.lang.annotation.Target; 33 34 /** 35 * The <code>Action</code> annotation allows explicit association of a 36 * WS-Addressing <code>Action</code> message addressing property with 37 * <code>input</code>, <code>output</code>, and 38 * <code>fault</code> messages of the mapped WSDL operation. 39 * <p> 40 * This annotation can be specified on each method of a service endpoint interface. 41 * For such a method, the mapped operation in the generated WSDL's 42 * <code>wsam:Action</code> attribute on the WSDL <code>input</code>, 43 * <code>output</code> and <code>fault</code> messages of the WSDL <code>operation</code> 44 * is based upon which attributes of the <code>Action</code> annotation have been specified. 45 * For the exact computation of <code>wsam:Action</code> values for the messages, refer 46 * to the algorithm in the JAX-WS specification. 47 * <p> 48 * <b>Example 1</b>: Specify explicit values for <code>Action</code> message addressing property 49 * for <code>input</code> and <code>output</code> messages. 50 * 51 * <pre> 52 * @WebService(targetNamespace="http://example.com/numbers") 53 * public class AddNumbersImpl { 54 * <b>@Action( 55 * input="http://example.com/inputAction", 56 * output="http://example.com/outputAction")</b> 57 * public int addNumbers(int number1, int number2) { 58 * return number1 + number2; 59 * } 60 * } 61 * </pre> 62 * 63 * The generated WSDL looks like: 64 * <pre> 65 * <definitions targetNamespace="http://example.com/numbers" ...> 66 * ... 67 * <portType name="AddNumbersPortType"> 68 * <operation name="AddNumbers"> 69 * <input message="tns:AddNumbersInput" name="foo" 70 * <b>wsam:Action="http://example.com/inputAction"</b>/> 71 * <output message="tns:AddNumbersOutput" name="bar" 72 * <b>wsam:Action="http://example.com/outputAction"</b>/> 73 * </operation> 74 * </portType> 75 * ... 76 * </definitions> 77 * </pre> 78 * 79 * <p> 80 * <b>Example 2</b>: Specify explicit value for <code>Action</code> message addressing property 81 * for only the <code>input</code> message. The <code>wsam:Action</code> values for the 82 * WSDL <code>output</code> message are computed using the algorithm in the JAX-WS specification. 83 * 84 * <pre> 85 * @WebService(targetNamespace="http://example.com/numbers") 86 * public class AddNumbersImpl { 87 * <b>@Action(input="http://example.com/inputAction")</b> 88 * public int addNumbers(int number1, int number2) { 89 * return number1 + number2; 90 * } 91 * } 92 * </pre> 93 * 94 * The generated WSDL looks like: 95 * <pre> 96 * <definitions targetNamespace="http://example.com/numbers" ...> 97 * ... 98 * <portType name="AddNumbersPortType"> 99 * <operation name="AddNumbers"> 100 * <input message="tns:AddNumbersInput" name="foo" 101 * <b>wsam:Action="http://example.com/inputAction"</b> /> 102 * <output message="tns:AddNumbersOutput" name="bar" 103 * <b>wsam:Action="http://example.com/numbers/AddNumbersPortType/AddNumbersResponse"</b>/> 104 * </operation> 105 * </portType> 106 * ... 107 * </definitions> 108 * </pre> 109 * 110 * It is legitimate to specify an explicit value for <code>Action</code> message addressing property for 111 * <code>output</code> message only. In this case, <code>wsam:Action</code> value for the 112 * WSDL <code>input</code> message is computed using the algorithm in the JAX-WS specification. 113 * 114 * <p> 115 * <b>Example 3</b>: See {@link FaultAction} annotation for an example of 116 * how to specify an explicit value for <code>Action</code> message addressing property for the 117 * <code>fault</code> message. 118 * 119 * @see FaultAction 120 * 121 * @since 1.6, JAX-WS 2.1 122 */ 123 124 @Documented 125 @Retention(RetentionPolicy.RUNTIME) 126 @Target(ElementType.METHOD) 127 public @interface Action { 128 /** 129 * Explicit value of the WS-Addressing <code>Action</code> message addressing property for the <code>input</code> 130 * message of the operation. 131 */ 132 String input() default ""; 133 134 /** 135 * Explicit value of the WS-Addressing <code>Action</code> message addressing property for the <code>output</code> 136 * message of the operation. 137 */ 138 String output() default ""; 139 140 /** 141 * Explicit value of the WS-Addressing <code>Action</code> message addressing property for the <code>fault</code> 142 * message(s) of the operation. Each exception that is mapped to a fault and requires an explicit WS-Addressing 143 * <code>Action</code> message addressing property, needs to be specified as a value in this property 144 * using {@link FaultAction} annotation. 145 */ 146 FaultAction[] fault() default { }; 147 } | 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 java.lang.annotation.Documented; 29 import java.lang.annotation.ElementType; 30 import java.lang.annotation.Retention; 31 import java.lang.annotation.RetentionPolicy; 32 import java.lang.annotation.Target; 33 34 /** 35 * The {@code Action} annotation allows explicit association of a 36 * WS-Addressing {@code Action} message addressing property with 37 * {@code input}, {@code output}, and 38 * {@code fault} messages of the mapped WSDL operation. 39 * <p> 40 * This annotation can be specified on each method of a service endpoint interface. 41 * For such a method, the mapped operation in the generated WSDL's 42 * {@code wsam:Action} attribute on the WSDL {@code input}, 43 * {@code output} and {@code fault} messages of the WSDL {@code operation} 44 * is based upon which attributes of the {@code Action} annotation have been specified. 45 * For the exact computation of {@code wsam:Action} values for the messages, refer 46 * to the algorithm in the JAX-WS specification. 47 * <p> 48 * <b>Example 1</b>: Specify explicit values for {@code Action} message addressing property 49 * for {@code input} and {@code output} messages. 50 * 51 * <pre> 52 * {@literal @}WebService(targetNamespace="http://example.com/numbers") 53 * public class AddNumbersImpl { 54 * <b>{@literal @}Action( 55 * input="http://example.com/inputAction", 56 * output="http://example.com/outputAction")</b> 57 * public int addNumbers(int number1, int number2) { 58 * return number1 + number2; 59 * } 60 * } 61 * </pre> 62 * 63 * The generated WSDL looks like: 64 * <pre> {@code 65 * <definitions targetNamespace="http://example.com/numbers" ...> 66 * ... 67 * <portType name="AddNumbersPortType"> 68 * <operation name="AddNumbers"> 69 * <input message="tns:AddNumbersInput" name="foo" 70 * <b>wsam:Action="http://example.com/inputAction"</b>/> 71 * <output message="tns:AddNumbersOutput" name="bar" 72 * <b>wsam:Action="http://example.com/outputAction"</b>/> 73 * </operation> 74 * </portType> 75 * ... 76 * </definitions> 77 * } 78 * </pre> 79 * 80 * <p> 81 * <b>Example 2</b>: Specify explicit value for {@code Action} message addressing property 82 * for only the {@code input} message. The {@code wsam:Action} values for the 83 * WSDL {@code output} message are computed using the algorithm in the JAX-WS specification. 84 * 85 * <pre> 86 * {@literal @}WebService(targetNamespace="http://example.com/numbers") 87 * public class AddNumbersImpl { 88 * <b>{@literal @}Action(input="http://example.com/inputAction")</b> 89 * public int addNumbers(int number1, int number2) { 90 * return number1 + number2; 91 * } 92 * } 93 * </pre> 94 * 95 * The generated WSDL looks like: 96 * <pre> {@code 97 * <definitions targetNamespace="http://example.com/numbers" ...> 98 * ... 99 * <portType name="AddNumbersPortType"> 100 * <operation name="AddNumbers"> 101 * <input message="tns:AddNumbersInput" name="foo" 102 * <b>wsam:Action="http://example.com/inputAction"</b>/> 103 * <output message="tns:AddNumbersOutput" name="bar" 104 * <b>wsam:Action="http://example.com/numbers/AddNumbersPortType/AddNumbersResponse"</b>/> 105 * </operation> 106 * </portType> 107 * ... 108 * </definitions> 109 * }</pre> 110 * 111 * It is legitimate to specify an explicit value for {@code Action} message addressing property for 112 * {@code output} message only. In this case, {@code wsam:Action} value for the 113 * WSDL {@code input} message is computed using the algorithm in the JAX-WS specification. 114 * 115 * <p> 116 * <b>Example 3</b>: See {@link FaultAction} annotation for an example of 117 * how to specify an explicit value for {@code Action} message addressing property for the 118 * {@code fault} message. 119 * 120 * @see FaultAction 121 * 122 * @since 1.6, JAX-WS 2.1 123 */ 124 125 @Documented 126 @Retention(RetentionPolicy.RUNTIME) 127 @Target(ElementType.METHOD) 128 public @interface Action { 129 /** 130 * Explicit value of the WS-Addressing {@code Action} message addressing property for the {@code input} 131 * message of the operation. 132 */ 133 String input() default ""; 134 135 /** 136 * Explicit value of the WS-Addressing {@code Action} message addressing property for the {@code output} 137 * message of the operation. 138 */ 139 String output() default ""; 140 141 /** 142 * Explicit value of the WS-Addressing {@code Action} message addressing property for the {@code fault} 143 * message(s) of the operation. Each exception that is mapped to a fault and requires an explicit WS-Addressing 144 * {@code Action} message addressing property, needs to be specified as a value in this property 145 * using {@link FaultAction} annotation. 146 */ 147 FaultAction[] fault() default { }; 148 } |