Conversation.jws Sample

A web service that demonstrates use of the @jws:conversation tag to control the lifecycle of a conversational instance of the web service and provide data persistence.

Conversation.jws implements a synchronous polling interface for the asynchronous HelloWorldAsync web service. A polling interface is necessary if you wish to serve clients that cannot accept asynchronous callbacks due to security arrangements such as firewalls.

Conversations also provide correlation, whereby requests from multiple simultaneous clients are tracked and responses are directed to the right client.

# Concepts Demonstrated by this Sample

- Use of a Service control

- Use of the JwsContext interface

- Use of Conversations

- Polling

# Location of Sample Files

This sample is located in the async folder of the samples WebLogic Workshop project. In the file system the location is:

BEA_HOME\weblogic700\samples\workshop\applications\samples\async\Conversation.jws

# How to Run the Sample

To run this web service:

1. Start WebLogic Server in the appropriate domain.

   - On Microsoft Windows systems, from the Start menu navigate to:

   BEA WebLogic Platform 7.0->WebLogic Workshop->WebLogic Workshop Examples->Start Examples Server.

   - On Linux or Solaris systems, run:

   BEA_HOME/weblogic700/samples/workshop/startWebLogic.sh

2. Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/samples/async/Conversation.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine, you may click here to run the sample.

3. Navigate to the Test Form tab of Test View, if necessary.

4. Invoke the startRequest method to create a new conversational instance and invoke the operation on the simulated legacy system.

5. Click on the conversation ID (the large number at the top of each section in the Message Log) to access that conversation's continue and finish methods.

6. Notice the call from Conversation.jws to helloAsync.HelloAsync. helloAsync is an instance of a Service control and HelloAsync is one of its methods.

7. Click on the conversation ID again to access the conversation's continue and finish methods.

8. Invoke the getRequestStatus method to see if the request is complete. If you do this before the helloAsync_onHelloResult callback arrives from the Service control, you will get a response telling you the back end system hasn't yet replied.

9. If you invoke getRequestStatus after the helloAsync_onHelloResult callback has arrives, getRequestStatus will return the result.

10. Click on the conversation ID again to access the conversation's continue and finish methods.

11. Invoke terminateRequest to finish the conversation. This releases the resources associated with this conversational instance of the web service.

12. Select log entries in the Message Log to see the message traffic involved in each interaction.

Related Topics

Controls: Using Resources from a Web Service

Service Control: Using Another Web Service

Maintaining State with Conversations

Using Polling as an Alternative to Callbacks

JwsContext Interface

Buffer.jws Sample

Test View