Skip to Main Content U.S. Department of Energy

Asynchronous MifWebServiceModule Sample

This sample demonstrates creating a one way, asynchronous web service using a MIF module. This type of web service receives data from the client, returns immediately but continues processing the received data and does not return the result to the client. This can be handy to use in a MIF pipeline when the client wants to simply kick off a series of (potentially long running) modules with a web service call, and does not need to receive a result.

This document covers:

  1. An overview of the EchoWebServiceAsynchTest
  2. How to run the sample
  3. A walkthrough of the code used to construct this sample


In this sample the client sends a string to the EchoServiceModule. The service call returns without any payload to the client right away. In the meantime, the string sent by the client is passed on to the SleepModule, which simply sleeps for a few seconds. This demonstrates that the pipeline continues to run even though the client has disconnected from the pipeline.

Asynchronous Oneway Web Service


Please review the Synchronous WebServiceModule example before running this one.

Running the samples

To start the MIF pipeline for this sample, run the following comand from MIF_HOME:

bin/ -c

Then use soapUI or wsdl2java to create a client for this service as described here: Synchronous WebServiceModule

Notice that the sample request message created by soapUI is identical to the synchronous version. However, when the message is sent, the echo-ed string is not returned to the client. It is instead returned to the next stage in the pipeline, SleepProcessor, which receives the string, sleeps for a few seconds and returns.

The key thing to notice when running the sample is that the client returns immediately after sending the soap message, even though the MIF pipeline continues to run.

Code Walkthrough

The oneway, asynchronous behavior is enabled via the @Oneway JAX annotation on the EchoAsynchInterface:

public interface EchoAsyncInterface {
  public String doEcho(@WebParam(name = "echoArg") String echoArg);

This causes the method to return to close the connection with the client without returning any data to it, even though there is a return value on the implementation class' listen() method. So, the value returned by EchoAsync is sent to the next stage in the pipeline which is Sleep processor.

asynchronous_webservicemodule.txt · Last modified: 2010/05/21 15:03 by adamw