Using WS-Policy to Specify Reliable Messaging Policy Assertions Managing the Life Cycle of the Reliable Message Sequence

Using Web Services Reliable Messaging 3-3

3.1.1 Using WS-Policy to Specify Reliable Messaging Policy Assertions

WebLogic Web services use WS-Policy files to enable a destination endpoint to describe and advertise its Web service reliable messaging capabilities and requirements. The WS-Policy files are XML files that describe features such as the version of the supported WS-ReliableMessaging specification and quality of service requirements. The WS-Policy specification http:www.w3.orgTRws-policy provides a general purpose model and syntax to describe and communicate the policies of a Web service. WebLogic Server includes pre-packaged WS-Policy files that contain typical reliable messaging assertions, as described in Appendix A, Pre-Packaged WS-Policy Files for Reliable Messaging. If the pre-packaged WS-Policy files do not suit your needs, you must create your own WS-Policy file. See Section 3.5, Creating the Web Service Reliable Messaging WS-Policy File for details. See Web Service Reliable Messaging Policy Assertion Reference in the WebLogic Web Services Reference for Oracle WebLogic Server for reference information about the reliable messaging policy assertions.

3.1.2 Managing the Life Cycle of the Reliable Message Sequence

The following figure shows a one-way reliable message exchange. Figure 3–1 Web Service Reliable Message Exchange A reliable message sequence is used to track the progress of a set of messages that are exchanged reliably between an RM source and RM destination. A sequence can be used to send zero or more messages, and is identified by a string identifier. This identifier is used to reference the sequence when using reliable messaging. The Web service client application sends a message for reliable delivery which is transmitted by the RM source to the RM destination. The RM destination acknowledges that the reliable message has been received and delivers it to the Web service application. The message may be retransmitted by the RM source until the acknowledgement is received. A Web service client sends messages to a target Web service by invoking methods on a JAX-RPC stub. The stub is associated with the port type of the reliable Web service and represents a programmatic interface to that service. WebLogic stores the identifier for the reliable message sequence within this stub. This causes the reliable message sequence to be connected to a single JAX-RPC stub. All messages that are sent using a given stub will use the same reliable messaging sequence, regardless of the number of messages that are sent using the stub. The JAX-RPC stub is created by the clientgen child element of the jwsc Ant task. Because WebLogic Server retains resources associated with the reliable sequence, it is recommended that you take steps to release these resources in a timely fashion. 3-4 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server WebLogic Server provides a utility class, weblogic.wsee.reliability.WsrmUtils , for use with the Web service reliable messaging. Use this class to perform common tasks such as set configuration options, get the sequence id, and terminate a reliable sequence. Under normal circumstances, a reliable sequence should be retained until all messages have been sent and acknowledged by the RM destination. To facilitate the timely and proper termination of a sequence, it is recommended that you identify the final message in a reliable message sequence. Doing so indicates you are done sending messages to the RM destination and that WebLogic Server can begin looking for the final acknowledgement before automatically terminating the reliable sequence. Indicate the final message using the weblogic.wsee.reliability.WsrmUtils .setFinalMessage method, passing the JAX-RPC stub being used to send messages to the RM destination. When you identify a final message, after all messages up to and including the final message are acknowledged, the reliable message sequence is terminated, and all resources are released. Otherwise, the sequence is terminated automatically after the configured sequence expiration period is reached. Although not recommended, you can terminate the sequence reliable message sequence regardless of whether all messages have been acknowledged using the terminateSequence method. Once issued, no further reliable messages can be sent on this stub. For more information about the WsrmUtils utility class, see weblogic.wsee.reliability.WsrmUtils in Oracle WebLogic Server API Reference.

3.2 Using Web Service Reliable Messaging: Main Steps