How Do I: Design a Web Service that Involves Long-Running Operations?

WebLogic Workshop introduces the notion of conversations to manage the state of your web service (stored in class member variables) over a long-running sequence of operations and correlate messages between your web service and its clients and controls. To use conversations, you simply set the conversation property on each method or callback, marking it as starting, continuing, or finishing a conversation. When a start method is called, WebLogic Server creates a new record (a conversation instance) for the state of the web service. When continue methods or callbacks are called, the state of the conversation is accessible. After a finish method or callback completes, the conversation state is deleted to release server resources.

To Specify the Conversational Behavior of a Web Service

1. In Design View, select a method you wish to start a conversation.

2. In the Properties pane, expand the conversation property.

3. On the phase attribute, from the drop-down list, select start.

4. Repeat steps 1 through 3 for each method that can start a conversation.

5. Select a method you wish to continue the conversation.

6. In the Properties pane, expand the conversation property.

7. On the phase attribute, from the drop-down list, select continue.

8. Repeat from steps 5 through 7 for each method that can continue a conversation.

9. Select a method you wish to finish the conversation.

10. In the Properties pane, expand the conversation property.

11. On the phase attribute, from the drop-down list, select finish.

12. Repeat steps 9 through 11 for each method that can finish a conversation.

To Specify Conversation Lifetime

Conversations represent server resources and should be released whenever possible. In addition to marking methods of a conversation to control how they affect conversation phase, you can also configure the maximum lifetime or idle time of a conversation. These properties will cause the conversation to be released after a specified period even if (or because) none of the conversational methods have been called.

To set the maximum lifetime of a conversation, regardless of whether or when continue or finish methods are called, set the max-age attribute of the conversation-lifetime property on the web service.

To set the maximum idle time of a conversation (the maximum time that may pass between method invocations), set the max-idle-time attribute of the conversation-lifetime property on the web service.

Related Topics

Maintaining State with Conversations

@jws:conversation-lifetime Tag