1/*
2 * Copyright (c) 2005, 2017, 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
26package javax.xml.ws;
27
28import java.lang.annotation.Documented;
29import java.lang.annotation.ElementType;
30import java.lang.annotation.Retention;
31import java.lang.annotation.RetentionPolicy;
32import 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)
128public @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     * @return {@code Action} message addressing property for the {@code input} message
134     */
135    String input() default "";
136
137    /**
138     * Explicit value of the WS-Addressing {@code Action} message addressing property for the {@code output}
139     * message of the operation.
140     *
141     * @return {@code Action} message addressing property for the {@code output} message
142     */
143    String output() default "";
144
145    /**
146     * Explicit value of the WS-Addressing {@code Action} message addressing property for the {@code fault}
147     * message(s) of the operation. Each exception that is mapped to a fault and requires an explicit WS-Addressing
148     * {@code Action} message addressing property, needs to be specified as a value in this property
149     * using {@link FaultAction} annotation.
150     *
151     * @return {@code Action} message addressing property for the {@code fault} message(s)
152     */
153    FaultAction[] fault() default { };
154}
155