Enabling Web Services Addressing support for JAX-WS applications using addressing annotations

For JAX-WS applications, you can enable WS-Addressing support during development of a service application, by using addressing annotations in the code. You can also use this method in a client application that uses an injected web service proxy reference.

About this task

Use one of the following addressing annotations in your service code:
  • Addressing - use this annotation if you want to use the 2005/08 WS-Addressing specification.
  • SubmissionAddressing - use this annotation if you want to use the 2004/08 WS-Addressing specification.
On clients, use the Addressing annotation only; the SubmissionAddressing annotation is not supported. You must specify the Addressing annotation in combination with the WebServiceRef annotation. The WebServiceRef annotation specifies a reference to the web service proxy that is injected by the client container.

Annotation settings override settings in the WSDL document. Annotation settings might differ from WSDL settings if you create the WSDL document manually rather than generating it from the code.

Specify up to three optional parameters for each annotation:
Table 1. Parameters for the addressing annotations. The table lists the different parameters with their possible values and a description of each one.
Parameter name Possible values Description
enabled

true (default)
false

Whether WS-Addressing support is enabled.
required

true
false (default)

Whether WS-Addressing headers are required.
responses

Responses.All (default)
Responses.ANONYMOUS
Responses.NON_ANONYMOUS

Whether to use a synchronous or an asynchronous message exchange pattern. Specify Responses.ANONYMOUS to send messages in a synchronous message pattern; use Responses.NON_ANONYMOUS to send messages in an asynchronous message exchange pattern.
Note: This parameter is not supported on the SubmissionAddressing annotation.
Note: You can use the Addressing annotation only with a SOAP (1.1 or 1.2) over HTTP binding. If you use the class with another binding, such as XML over HTTP, an exception is thrown on clients, and on servers the web service fails to deploy.

Procedure

Results

If you use an addressing annotation in the service application, the server processes any WS-Addressing headers that conform to the relevant specification in inbound SOAP messages. If you specify that WS-Addressing is required, and an inbound SOAP message does not include any WS-Addressing headers, or includes WS-Addressing headers that do not conform to the specification indicated by the annotation, the server returns a fault message. For example, if a client sends a message that includes 2004/08 WS-Addressing headers, and the server requires 2005/08 headers, the server returns a fault message.

If you use the Addressing annotation and generate a WSDL document from the code, a UsingAddressing element and WS-Policy assertions are created in the WSDL document. Clients that use this WSDL document will include WS-Addressing information in their messages. The SubmissionAddressing annotation is not understood by current WSDL generation tools. However, the WSDL document does not distinguish between the 2005/08 specification and the 2004/08 specification, so if you want to generate a WSDL document from code that contains a SubmissionAddressing annotation, use both the Addressing and SubmissionAddressing annotations together.

If you specify the responses attribute, the corresponding message exchange pattern will be used.




In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Jan 30, 2014 9:17:32 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-iseries&topic=twbs_wsa_dep_jaxws_annot
File name: twbs_wsa_dep_jaxws_annot.html