Web Services Addressing annotations


 

+

Search Tips   |   Advanced Search

 

New feature: WAS V7.0 provides support for the WS-Addressing annotations specified by the JAX-WS 2.1 standard. Use these annotations in the Java code for a Web service, to...

The following WS-Addressing annotations are supported in WAS V7.0. These annotations are defined in the JAX-WS 2.1 spec unless otherwise stated.

javax.xml.ws.Action

Action that is associated with a Web service operation.

When you use this annotation with a particular method, and generate the corresponding WSDL document, the WS-Addressing Action extension attribute is added to the input and output elements of the WSDL operation that corresponds to that method. For this attribute to be added to the WSDL operation also specify the Addressing annotation on the implementation class. If we do not want to use the Addressing annotation we can supply our own WSDL document with the Action attribute already defined.

javax.xml.ws.FaultAction

Action that is added to a fault response.

When you use this annotation with a particular method, the WS-Addressing FaultAction extension attribute is added to the fault element of the WSDL operation that corresponds to that method. For this attribute to be added to the WSDL operation also specify the Addressing annotation on the implementation class. If we do not want to use the Addressing annotation we can supply our own WSDL document with the Action attribute already defined. This annotation must be contained within an Action annotation.

javax.xml.ws.soap.Addressing

This service wants to enable WS-Addressing support.

We can use this annotation only on the service implementation bean; we cannot use it on the service endpoint interface.

com.ibm.websphere.wsaddressing.jaxws21.SubmissionAddressing

This annotation is part of the IBM implementation of the JAX-WS 2.1 specification.

This annotation specifies that this service wants to enable WS-Addressing support for the 2004/08 WS-Addressing specification. Use this annotation only on the service implementation bean; we cannot use it on the service endpoint interface.

The following example code uses the Action annotation to define the invoke operation to be invoked (input), and the action that is added to the response message (output).

The example also uses the FaultAction annotation to specify the action that is added to a response message if a fault occurs:

@WebService(name = "Calculator")
 public interface Calculator {
   ...
   @Action( input="http://calculator.com/inputAction",       
            output="http://calculator.com/outputAction",       
            fault = { 
                       @FaultAction(className=AddNumbersException.class, 
                       value="http://calculator.com/faultAction") 
                    }
          )

   public int add(int value1, int value2) throws AddNumbersException 
   {
       return value1 + value2;
   }

If we use a tool to generate service artefacts from code, the WSDL tags that are generated from the preceding example are as follows:

<definitions targetNamespace="http://example.com/numbers" ...>

   ...

   <portType name="AddPortType">

      <operation name="Add">

         <input message="tns:AddInput" 
                name="Parameters"
                wsaw:Action="http://calculator.com/inputAction"/>

         <output message="tns:AddOutput" 
                 name="Result"
                 wsaw:Action="http://calculator.com/outputAction"/>

         <fault message="tns:AddNumbersException" name="AddNumbersException"
                wsaw:Action="http://calculator.com/faultAction"/>

      </operation>

    <portType>

    ...

<definitions>




 

Related concepts

Web Services Addressing support

 

Related tasks

Create a JAX-WS Web service application that uses Web Services Addressing
Enable Web Services Addressing support for JAX-RPC applications

 

Related

JAX-WS annotations