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

Location of Sample Files

This sample is located in the async folder of the WebServices project in the SamplesApp sample application. In the file system the location is:

BEA_HOME\weblogic81\samples\workshop\SamplesApp\WebServices\async\Conversation.jws

To Run the Sample

  1. Start WebLogic Server in the appropriate domain.
  2. Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/WebServices/async/Conversation.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine and you have deployed the SamplesApp sample application, 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 Web Service control and HelloAsync is one of its methods.
  7. 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.
  8. If you invoke getRequestStatus after the helloAsync_onHelloResult callback has arrives, getRequestStatus will return the result.
  9. Click on the conversation ID again to access the conversation's continue and finish methods.
  10. Invoke terminateRequest to finish the conversation. This releases the resources associated with this conversational instance of the web service.
  11. Select log entries in the Message Log to see the message traffic involved in each interaction.

Related Topics

Using WebLogic Built-In Controls

Web Service Control

Designing Conversational Web Services

Using Polling as an Alternative to Callbacks

JwsContext Interface

Buffer.jws Sample

Test View