Creating Conversational Web Services 4-9
■
Once the conversation is completed, invoke the finish operation so that the conversational Web service can free up the resources it used for the current
conversation:
result = port.finishmessage ;
■
If you want to reuse the Web service conversation stub to start a new conversation, you must explicitly renew the stub using the renewStub method of the
weblogic.wsee.conversation.ConversationUtils utility class:
ConversationUtils.renewStubStubport;
4.5 ConversationUtils Utility Class
WebLogic Server provides a utility class for use with the conversation feature. Use this class to perform common tasks such as getting and setting the conversation ID and
setting configuration options. Some of these tasks are performed in the conversational Web service, some are performed in the client that invokes the conversational Web
service. See
Section 4.4, Programming Guidelines for the JWS File That Invokes a Conversational Web Service
for an example of using this class. See weblogic.wsee.conversation.ConversationUtils in Oracle WebLogic Server API
Reference for details.
4.6 Updating the build.xml File for a Client of a Conversational Web Service
You update a build.xml file to generate the JWS file that invokes a conversational Web service by adding taskdefs and a build-clientService target that looks
something like the following example. See the description after the example for details.
taskdef name=jwsc classname=weblogic.wsee.tools.anttasks.JwscTask
target name=build-clientService jwsc
enableAsyncService=true srcdir=src
destdir={clientService-ear-dir}
jws file=exampleswebservicesconversationConversationalClientImpl.java
clientgen wsdl=http:{wls.hostname}:{wls.port}convConversationalService?WSDL
packageName=examples.webservices.conversation
jws
Note: The client Web service that invokes a conversational Web
service is not required to also be conversational. However, if the client is not conversational, there is a danger of multiple instances of this
client accessing the same conversational Web service stub and possibly corrupting the saved conversational state. If you believe this
might true in your case, then specify that the client Web service also be conversational.
4-10 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server
jwsc target
Use the taskdef Ant task to define the full classname of the jwsc Ant tasks. Update the jwsc Ant task that compiles the client Web service to include a
clientgen child element of the jws element so as to generate and compile the
JAX-RPC stubs for the deployed ConversationalService Web service. The jwsc Ant task automatically packages them in the generated WAR file so that the client
Web service can immediately access the stubs. You do this because the ConversationalClientImpl
JWS file imports and uses one of the generated classes.
4.7 Updating a Stand-Alone Java Client to Invoke a Conversational Web Service