Develop a Java API
for XML-Based Web Services (JAX-WS) provider or requester application
that can compose with a WS-ReliableMessaging-enabled policy set.
Before you begin
At any stage - that is, before or after you have built your reliable Web service application, or configured your policy sets - you can set a property that configures endpoints to only support clients that use reliable messaging. This setting is reflected by WS-Policy if engaged.
About this task
You can develop a Java API
for XML-Based Web Services (JAX-WS) Web service requester application
that sends messages reliably, or a Web service provider application
that requires reliable messaging. Your client application can also
take programmatic control of WS-ReliableMessaging sequences.
Procedure
- Develop
your JAX-WS Web service application.
For a Web
service requester application that sends messages reliably:
- Get an implementation WSDL document, and select the SOAP over
HTTP binding. The WSDL should be WS-I Basic Profile compliant.
- Build the JAX-WS application from the WSDL implementation document.
- (Optional) Enable transaction support for outbound (requester)
one-way message sends. For more information, see Providing transactional recoverable messaging through WS-ReliableMessaging.
- (Optional) Use the waitUntilSequenceCompleted method on the sequenceManager to ensure that reliable messaging state is released after the client finishes messaging,
as described in the Controlling WS-ReliableMessaging sequences programmatically topic.
- (Optional) If you want to use in-order delivery (that is, you
want WS-ReliableMessaging to make messages available to your requester
application in the order that they were sent), then you must also
configure your requester application to poll for the messages in the
order in which it should receive them. For more information, see Configuring the WS-ReliableMessaging policy.
For a Web service provider application that requires reliable
messaging:
- Write or get an interface WSDL document that describes the service
interface. The document should be compliant with the WS-I Basic Profile.
- Write or get an implementation WSDL document, and select the SOAP
over HTTP binding. The WSDL should remain WS-I Basic Profile compliant.
- Build the JAX-WS application from the WSDL implementation document.
- Enable your client application to take programmatic control
of WS-ReliableMessaging sequences.
This helps manage resources on the server, for example by removing sequences after a client application has finished messaging. You can add code to create sequences, send acknowledgement requests, close sequences, terminate sequences and wait until sequences are complete. For more information,
including example code, see Controlling WS-ReliableMessaging sequences programmatically.