Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxws/src/share/jaxws_classes/javax/xml/ws/Action.java
38890 views
/*1* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.ws;2627import java.lang.annotation.Documented;28import java.lang.annotation.ElementType;29import java.lang.annotation.Retention;30import java.lang.annotation.RetentionPolicy;31import java.lang.annotation.Target;3233/**34* The <code>Action</code> annotation allows explicit association of a35* WS-Addressing <code>Action</code> message addressing property with36* <code>input</code>, <code>output</code>, and37* <code>fault</code> messages of the mapped WSDL operation.38* <p>39* This annotation can be specified on each method of a service endpoint interface.40* For such a method, the mapped operation in the generated WSDL's41* <code>wsam:Action</code> attribute on the WSDL <code>input</code>,42* <code>output</code> and <code>fault</code> messages of the WSDL <code>operation</code>43* is based upon which attributes of the <code>Action</code> annotation have been specified.44* For the exact computation of <code>wsam:Action</code> values for the messages, refer45* to the algorithm in the JAX-WS specification.46* <p>47* <b>Example 1</b>: Specify explicit values for <code>Action</code> message addressing property48* for <code>input</code> and <code>output</code> messages.49*50* <pre>51* @WebService(targetNamespace="http://example.com/numbers")52* public class AddNumbersImpl {53* <b>@Action(54* input="http://example.com/inputAction",55* output="http://example.com/outputAction")</b>56* public int addNumbers(int number1, int number2) {57* return number1 + number2;58* }59* }60* </pre>61*62* The generated WSDL looks like:63* <pre>64* <definitions targetNamespace="http://example.com/numbers" ...>65* ...66* <portType name="AddNumbersPortType">67* <operation name="AddNumbers">68* <input message="tns:AddNumbersInput" name="foo"69* <b>wsam:Action="http://example.com/inputAction"</b>/>70* <output message="tns:AddNumbersOutput" name="bar"71* <b>wsam:Action="http://example.com/outputAction"</b>/>72* </operation>73* </portType>74* ...75* </definitions>76* </pre>77*78* <p>79* <b>Example 2</b>: Specify explicit value for <code>Action</code> message addressing property80* for only the <code>input</code> message. The <code>wsam:Action</code> values for the81* WSDL <code>output</code> message are computed using the algorithm in the JAX-WS specification.82*83* <pre>84* @WebService(targetNamespace="http://example.com/numbers")85* public class AddNumbersImpl {86* <b>@Action(input="http://example.com/inputAction")</b>87* public int addNumbers(int number1, int number2) {88* return number1 + number2;89* }90* }91* </pre>92*93* The generated WSDL looks like:94* <pre>95* <definitions targetNamespace="http://example.com/numbers" ...>96* ...97* <portType name="AddNumbersPortType">98* <operation name="AddNumbers">99* <input message="tns:AddNumbersInput" name="foo"100* <b>wsam:Action="http://example.com/inputAction"</b> />101* <output message="tns:AddNumbersOutput" name="bar"102* <b>wsam:Action="http://example.com/numbers/AddNumbersPortType/AddNumbersResponse"</b>/>103* </operation>104* </portType>105* ...106* </definitions>107* </pre>108*109* It is legitimate to specify an explicit value for <code>Action</code> message addressing property for110* <code>output</code> message only. In this case, <code>wsam:Action</code> value for the111* WSDL <code>input</code> message is computed using the algorithm in the JAX-WS specification.112*113* <p>114* <b>Example 3</b>: See {@link FaultAction} annotation for an example of115* how to specify an explicit value for <code>Action</code> message addressing property for the116* <code>fault</code> message.117*118* @see FaultAction119*120* @since JAX-WS 2.1121*/122123@Documented124@Retention(RetentionPolicy.RUNTIME)125@Target(ElementType.METHOD)126public @interface Action {127/**128* Explicit value of the WS-Addressing <code>Action</code> message addressing property for the <code>input</code>129* message of the operation.130*/131String input() default "";132133/**134* Explicit value of the WS-Addressing <code>Action</code> message addressing property for the <code>output</code>135* message of the operation.136*/137String output() default "";138139/**140* Explicit value of the WS-Addressing <code>Action</code> message addressing property for the <code>fault</code>141* message(s) of the operation. Each exception that is mapped to a fault and requires an explicit WS-Addressing142* <code>Action</code> message addressing property, needs to be specified as a value in this property143* using {@link FaultAction} annotation.144*/145FaultAction[] fault() default { };146}147148149