Asyncronous Invocation
Introduction
This sample shows the use of asynchronous one-way invokes and correlation data. The BPEL process receives a doc/literal message, calls an external echo Web service via a one-way invoke, and uses a receive to wait for a reply to come in via a separate callback message. The service sleeps for 15 seconds before sending its reply.
Invokes can be two-way or one-way. When two-way, the invoke waits for a reply from the Web service it has invoked. In that case, a WSDL fault may be returned as well. When an invoke is one-way, the invoke does not wait for a reply, nor will it ever receive a WSDL fault. An asynchronous invoke requires only an input variable. No output variable is specified.
The diagram below represents the BPEL process. First, the process receives a start message that contains an input string. The following assign activity copies that string into the input message for the first invoke. The first invoke is one-way; it sends the input message but does not wait for a reply. Next, the receive activity waits for an incoming message; in this case that is the callback message coming from the Web service we just invoked. Finally, the reply at the end of the process returns the response from the Web service.
The Web service used by the BPEL process uses
java.util.logging.Logger to
log messages about the echo-receiving thread. The log file is named
async_service_debug.txt, and is created in the
java.io.tmpdir directory. Since the Web service is run
within an
app server, the server's value of java.io.tmpdir is used.
For
example, under Tomcat running on Windows the value of
java.io.tmpdir is %CATALINA_HOME%\temp.
Deploying the Process
You need to deploy the BPEL process and the Web service. To deploy the BPEL process, see Deploying the Samples.
To deploy the Web service, copy the file
async_echo_web_services.wsr from the Resources/dist
directory to the place appropriate for your app server. For example, on
Tomcat
that would be the $CATALINA_HOME/bpr directory.
Running the Process
See Running the Samples.
The
service name to use is AsyncEchoCallerService. The sample data file
async_echo.xml can be used as input for this example.
Remember
that when you submit the sample data, the service will take 15 seconds
to
respond.
Copyright © 2004–2007 Active Endpoints, Inc.
