Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop web services - Addressing (WS-Addressing) > Enable Web Services Addressing support for JAX-WS applications


Enable 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. Use one of the following addressing feature classes in your client code:

If you use both feature classes, the specification used depends on the type of endpoint reference that you also specify. For example, if you specify a W3CEndpointReference object, the specification used is the 2005/08 specification. If you 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 you 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)
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.

We 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:

AddressFeature 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.
IBM proprietary Web Services Addressing SPIs
Enable Web Services Addressing support for JAX-RPC applications
Enable Web Services Addressing support for JAX-WS applications

+

Search Tips   |   Advanced Search