Enabling Web Services Addressing support for JAX-WS applications using addressing features
For JAX-WS applications, you can enable WS-Addressing support during development of a client application, by using addressing features in the code.
About this task
- AddressingFeature - use this class if you want to send messages that include WS-Addressing headers that conform to the 2005/08 WS-Addressing specification
- SubmissionAddressingFeature - use this class if you want to send messages that include WS-Addressing headers that conform to the 2004/08 WS-Addressing specification
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 for the SubmissionAddressingFeature class.
|
Note: You can use the addressing feature classes 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
Create an instance of one of the addressing feature classes,
with parameters as required.
For example, to specify
that WS-Addressing is enabled and required, and that the 2005/08 specification
and the asynchronous message exchange pattern is used, use the following
code:
AddressingFeature feat = new AddressingFeature(true, true, AddressingFeature.Responses.NON_ANONYMOUS);
To
specify that WS-Addressing is disabled for the 2004/08 specification,
use the following code: SubmissionAddressingFeature feat = new SubmissionAddressingFeature(false);
Results
If you specify that WS-Addressing is enabled, the client includes WS-Addressing headers in SOAP messages. The headers conform to the WS-Addressing specification indicated by the type of feature class used. If the server does not use annotations, or uses policy sets to enable WS-Addressing, the server accepts both the 2005/08 and 2004/08 specifications.
If you specify that WS-Addressing is required and the client receives a message that does not include WS-Addressing headers, the client returns a fault.
If you specify the responses attribute, the corresponding message exchange pattern will be used.