This topic applies only to the IBM Business Automation Workflow Advanced
configuration.

Developing service components

Draft comment:
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15
Develop service components to provide reusable logic to multiple applications within your server.

Before you begin

This task assumes that you have already developed and identified processing that is useful for multiple modules.

About this task

Multiple modules can use a service component. Exporting a service component makes it available to other modules that refer to the service component through an interface. This task describes how to build the service component so that other modules can use it.
Note: A single service component can contain multiple interfaces.

Procedure

  1. Define the data object to move data between the caller and the service component.

    The data object and its type is part of the interface between the callers and the service component.

  2. Define an interface that the callers will use to reference the service component.

    This interface definition names the service component and lists any methods available within the service component.

  3. Generate the class that implements calling the service.
  4. Develop the implementation of the generated class.
  5. Save the component interfaces and implementations in files with a .java extension.
  6. Package the service module and necessary resources in a JAR file.

    See Deploying a module to a production server in this documentation for a description of steps 6 through 8.

  7. Run the serviceDeploy command to create an installable EAR file containing the application.
  8. Install the application on the server node.
  9. Optional: Configure the wires between the callers and the corresponding service component, if calling a service component in another service module.

    The Administering section of this documentation describes configuring the wires.

Examples of developing components

This example shows a synchronous service component that implements a single method, CustomerInfo. The first section defines the interface to the service component that implements a method called getCustomerInfo.
public interface CustomerInfo {
	public Customer getCustomerInfo(String customerID);
}
The following block of code implements the service component.
public class CustomerInfoImpl implements CustomerInfo {
	public Customer getCustomerInfo(String customerID) {
		Customer cust = new Customer();

		cust.setCustNo(customerID);
		cust.setFirstName("Victor");
		cust.setLastName("Hugo");
		cust.setSymbol("IBM");
		cust.setNumShares(100);
		cust.setPostalCode(10589);
		cust.setErrorMsg("");

		return cust;
	}
}
The following section is the implementation of the class associated with StockQuote.
public class StockQuoteImpl implements StockQuote {
	
	public float getQuote(String symbol) {


	    return 100.0f;
	}
}

What to do next

Invoke the service.