IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Service Component Architecture programming > SCA programming model fundamentals > Developing service modules

Developing service components

Develop service components to provide reusable logic to multiple applications within your server.

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

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.

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 information center 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 information center 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.

Developing service modules