< Previous | Next >

Lesson 3: Create service interfaces

This content applies to version 7.5.4 or later. In most cases, such as in real-world models, you have many candidate services that you can design and implement, and you typically prioritize them. However, in this tutorial, you design and implement all four candidate services.

To model these services for IT purposes, you create a service interface for each candidate service. Each service interface realizes an interface that defines the operations it provides. Each service interface can also declare that it uses (requires) one or more interfaces. To maintain traceability from the service interfaces to the capabilities, you create «expose» dependency relationships between them.

Create a package to store the service interfaces

For organizational purposes, in this tutorial, you store the service interfaces in one package.

To create a package:

  1. Add a package to the Main diagram of the service model and name it interfaces.
  2. The Main diagram is automatically created in the interfaces package; however, to avoid confusion, delete the diagram because you do not use it.

Create the SchedulingService service interface

The SchedulingService realizes an interface that defines the operations it provides.

To create the SchedulingService service interface:

  1. In the Project Explorer view, right-click the interfaces package; then click Add UML > Package.
  2. In the Main diagram of the scheduling package, add the Scheduling capability.
  3. In the diagram editor, right-click the Scheduling capability; then click Add Services Modeling > ServiceInterface (simple).
  4. Name the interface SchedulingService. The following image shows the SchedulingService service interface and the Scheduling capability:
    SchedulingService service interface and the Scheduling Capability
    Note: The SchedulingService interface has an «Expose» dependency relationship to the Scheduling capability that constitutes the traceability link. The SchedulingService interface also automatically has the same operations as the capability.
  5. Click File > Save; then close the diagram.

Create the InvoicingService service interface

The InvoicingService service interface represents the operations that must be implemented by any service that provides the InvoicingService service interface. Creating this interface is slightly more complicated than creating the SchedulingService interface because it requires the service consumer to also provide an interface.
To create the InvoicingService service interface:
  1. In the Project Explorer view, right-click the interfaces package; then click Add UML > Package and name the package invoicing.
  2. In the Main diagram of the invoicing package, add the Invoicing capability.
  3. Right-click the Invoicing capability; then click Add Services Modeling > ServiceInterface (collaborating).
  4. Name the new service interface InvoicingService. The following image shows the InvoicingService service interface and the Invoicing capability:
    InvoicingService service interface and the Invoicing Capability
  5. In the diagram editor, drag the outgoing connector handle of the InvoicingService interface to an empty location in the diagram.
  6. Click Create Interface Realization To > > New Element: Interface; then, name the new interface Invoicing. An interface realization relationship is created from the InvoicingService service interface to the Invoicing interface. The Invoicing interface represents the operations that must be implemented by any service that provides the InvoicingService service interface. Therefore, these provided operations are more appropriately defined by the Invoicing interface.
  7. In the Project Explorer view, drag each operation in the InvoicingService interface to the Invoicing interface. The InvoicingService inteface must be able to request the processing of an invoice by the requester, similar to a callback.
  8. To define another interface to represent the callback, in the diagram editor, drag the outgoing connector handle of the InvoicingService implementation to an empty location in the diagram.
  9. Click Create Usage To > > New Element: Interface; then, name the new interface InvoiceProcessing.
  10. In the diagram editor, right-click the InvoiceProcessing interface; then click Add UML > Operation.
  11. Name the operation ProcessInvoice. Your diagram should look like the following image:
    Invoicing Main diagram
  12. Click File > Save; then close the diagram.

Create the ShippingService service interface

The ShippingService service interface requests the processing of a shipping schedule to the service consumer.
To create the ShippingService service interface:
  1. In the Project Explorer view, right-click the interfaces package; then click Add UML > Package and name the package shipping.
  2. In the Main diagram of the invoicing package, add the Shipping capability.
  3. Right-click the Shipping capability; then click Add Services Modeling > ServiceInterface (collaborating).
  4. Name the new service interface ShippingService.
  5. In the diagram editor, drag the outgoing connector handle of the ShippingService interface to an empty location in the diagram.
  6. Click Create Interface Realization To > > New Element: Interface; then, name the new interface Shipping.
  7. Move only the requestShipping operation from the ShippingService interface to the Shipping interface to represent the operation that the service provides.
  8. A ShippingService implementation must be able to request the processing of a shipping schedule to the service consumer. To represent this ability, drag the outgoing connector handle of the ShippingService interface to an empty location in the diagram.
  9. Click Create Usage To > > New Element: Interface; then, name the new interface ScheduleProcessing.
  10. Move the processSchedule operation from the ShippingService interface to the new ScheduleProcessing interface. This construct represents the operation that the service consumer must implement. Your shipping diagram should look like the following image:
    Shipping Main diagram
  11. Click File > Save; then close the diagram.

Create the PurchasingService service interface

The PurchasingService service interface represents the service that the process as a whole exposes, or provides, to the external world.
To create the PurchasingService service interface:
  1. In the Project Explorer view, right-click the interfaces package; then click Add UML > Package> and name the package Purchasing.
  2. In the Main diagram of the invoicing package, add the Purchasing capability.
  3. Right-click the Purchasing capability; then click Add Services Modeling > ServiceInterface (collaborating).
  4. Name the new service interface PurchasingService.
  5. In the diagram editor, drag the outgoing connector handle of the ShippingService interface to an empty location in the diagram.
  6. Click Create Interface Realization To > > New Element: Interface; then, name the new interface Purchasing. You now have an interface realization relationship from the PurchasingService service interface to the Purchasing interface.
  7. Move the processPurchaseOrder operation from the PurchasingService interface to the Purchasing interface to represent the operation that the purchasing service provides.
  8. A PurchasingService implementation must be able to request scheduling from the scheduling service. To represent this ability, drag the outgoing connector handle of the PurchasingService interface to an empty location in the diagram.
  9. Click Create Usage To > > Existing Element; then click the SchedulingService service interface. Your Purchasing diagram should look like the following image:
    Purchasing Main diagram
  10. Click File > Save; then close the diagram.

Lesson checkpoint

You just created all four candidate services.
You will build upon these services in upcoming lessons.
< Previous | Next >

Feedback