In this step you will enable asynchronous communication for the
web service. You will add an asynchronous method that immediately
returns a simple acknowledgement to the client, thereby allowing
the client to continue its own processes. You will also add a callback
method that returns the response to the client. Finally, you will
add buffers to the method and the callback to further minimize the
time the client or web service has to wait while the method invoked
or callback returned is processed by the receiving party.
The tasks in this step are:
Add a Method
- Right-click the web service in the main area and select Add
Method.
- The method newMethod1 appears.
Rename this method hello_async.
If you step off the method before you have finished renaming it,
right-click the method and select Rename.
-
Make sure that
hello_asynch is
still selected and go to the
Property Editor.
Locate the conversation section and for the
phase attribute,
select
start.
A green start icon will appear on the blue arrow in front of
the
hello_asynch method.
Add a Callback
- Right-click the web service in the main area and select Add
Callback.
- The method newCallback1 appears.
Rename this method hello_callback.
If you step off the method before you have finished renaming
it, right-click the method and select Rename.
-
Make sure that
hello_callback is
still selected and go to the
Property Editor.
Locate the conversation section and for the
phase attribute,
select
finish.
A red stop icon will appear on the blue arrow in front
of the
hello_callback method.
-
Click hello_callback to go to Source View and modify the
method as shown in red below:
public interface Callback extends com.bea.control.ServiceControl
{
/**
* @jws:conversation phase="finish"
*/
void hello_callback(String message);
}
In Design View the web service should now look like this:

Edit the Method
Now you will edit the hello_asynch method
to invoke the hello_callback callback.
- In Design View, click hello_asynch to
go to Source View and modify the method as shown in red below:
/**
* @common:operation
* @jws:conversation phase="start"
*/
public void hello_asynch(String name)
{
String greeting;
greeting = "Hello, " + name + "!";
this.callback.hello_callback(greeting);
}
Add Buffers
- Click the Design View tab.
- In Design View, select the hello_asynch method
by selecting the blue arrow in front of the method.
-
In the
Property Editor, locate the
message-buffer section
and set the
enable attribute
to
true. Notice that a buffer
icon appears on the blue arrow.
- In Design View, select the hello_callback method
by selecting the blue arrow in front of the method.
- In the Property Editor, locate the message-buffer section
and set the enable attribute
to true. Notice that a buffer
icon appears on the blue arrow.
The completed web service should look like this:

Test the Web Service
Next you will test the web service to examine its behavior.
-
Click the
Start button, shown below:

-
When the
Workshop Test Browser launches,
in the
Name field, enter
[your_name] and
click
hello_asynch.
-
Notice that the method returns immediately. Scroll down to
the
Service Response section and notice that
the method did not return anything
. Also notice that
the conversation has started.
- Click the Continue this conversation link. Notice
in the Message Log that the the hello_callback method
has been invoked and that the conversation is finished. Also notice
that no greeting is returned as a return value of the method; instead
the callback method sends the greeting as a parameter to the invoking
client.
- Return to WebLogic Workshop and press the Stop button
to close the Test Browser.