WAS v8.5 > Develop applications > Develop web services - Addressing (WS-Addressing) > Enable Web Services Addressing support for JAX-WS applicationsEnable 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.
Use one of the following addressing feature classes in your client code:
- AddressingFeature - use this class to send messages that include WS-Addressing headers that conform to the 2005/08 WS-Addressing specification
- SubmissionAddressingFeature - use this class to send messages that include WS-Addressing headers that conform to the 2004/08 WS-Addressing specification
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:
Parameters for the addressing features. The table lists the different addressing feature parameters as well as their possible values and a description of each one.
Parameter name Possible values Description enabled true (default)
falseWhether WS-Addressing support is enabled. required true
false (default)Whether WS-Addressing headers are required. responses Responses.All (default)
Responses.ANONYMOUS
Responses.NON_ANONYMOUSWhether 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.
We can 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.
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 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 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 concepts:
IBM proprietary Web Services Addressing SPIs
Related
Enable Web Services Addressing support for JAX-RPC applications