+

Search Tips   |   Advanced Search

Enable Web Services Addressing support for JAX-WS applications using addressing features

For JAX-WS applications, we can enable WS-Addressing support during development of a client application, using addressing features in the code.

Using one of the following addressing feature classes in the client code:

If we use both feature classes, the specification used depends on the type of endpoint reference that you also specify. For example, if we specify a W3CEndpointReference object, the specification used is the 2005/08 specification. If we specify an endpoint reference whose type conflicts with that indicated by the feature class, for example a W3CEndpointReference object with a SubmissionAddressingFeature instance, an error is thrown. If we do not specify an endpoint reference, the default specification is the 2005/08 specification. Specify up to three optional parameters for each addressing feature instance:

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.

This parameter is not supported for the SubmissionAddressingFeature class.

Use the addressing feature classes only with a SOAP (1.1 or 1.2) over HTTP binding. If we 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.


Tasks

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);

If we 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 we 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 we specify the responses attribute, the corresponding message exchange pattern will be used.


Related:

  • IBM proprietary Web Services Addressing SPIs
  • Enable Web Services Addressing support for JAX-RPC applications