< Previous | Next >

Lesson 4: Create service contracts

This content applies to version 7.5.4 or later. In this lesson, you create three service contracts. Service contracts specify additional details about how service interfaces are used and how the operations of the service interfaces are ordered.

Create a package to contain the service contracts

For organizational purposes, you create a package to contain the service contracts.
To create a package:
  1. In the Project Explorer view, right-click the model folder, then click Create Model.
  2. In the Model wizard, in the Categories pane, click Servicing Model .
  3. In the Templates pane, click Blank Services Package.
  4. Name the package contracts. The Main diagram opens in the diagram editor.

Creating the InvoicingContract service contract

The InvoicingContract specifies the parts that the service contract and service interfaces will use.

To Create service the InvoicingService contract:

  1. In the Palette, click Service Contract and drag the cursor into the diagram editor.
  2. Name the service contract InvoicingContract.
  3. In the Project Explorer, right-click the InvoicingContract then click Add Services Modeling > Part and click Unspecified.
  4. In the diagram editor, click the new part in the InvoicingContract element.
  5. On the Properties page, name the part orderer and specify its type as InvoiceProcessing interface. This part represents the requester of the InvoicingService interface.
  6. To create another part, repeat step 3 to step 5, but name this part invoicing and set its type to the Invoicing interface. This part represents the provider of the service.
  7. The InvoicingContract service contract should look like the following:

Add an activity diagram to the InvoicingContract service contract

You can add an activity diagram to show the flow of events from the InvoicingContract service contract.

To add an activity diagram to the InvoicingContract service contract:

  1. In the diagram editor, right-click the InvoicingContract service contract; then click Add Diagram > Activity Diagram ..
  2. Name the diagram diagram and set the activity to protocol
  3. In the Palette click Partition click in the activity diagram and name the partition orderer.
  4. In the Properties view, on the General page, click Set, and specify the orderer part element in the service contract.
  5. In the Palette click Partition, click in the diagram, and name the partition invoicing.
  6. In the Properties view, on the General page, click the Set and specify the invoicing part element in the service contract.
  7. In the Palette, click Initial node and drag the cursor to the orderer partition.
  8. In the Palette, click Flow, click the Initial node, drag the cursor to the invoicing partition and click Create Flow To New Element: Call Operation Action > Select Existing Element.
  9. In the Select Element dialog box, click the initiatePriceCalculation operation of the Invoicing interface. The activity diagram should like the following:
  10. In the Palette, click Flow, click the initiatePriceCalculation node, drag the cursor downward, and click Create Flow To New Element: Call Operation Action > Select Existing Element.
  11. In the Select Element dialog box, click the completePriceCalculation operation of the Invoicing interface.
  12. In the Palette, click Flow, click the completePriceCalculation node, drag the cursor to the orderer partition, and click Create Flow To New Element: Call Operation Action > Select Existing Element.
  13. In the Select Element dialog box, click the processInvoice operation of the InvoiceProcessing interface.
The activity diagram should look like the following:
< Previous | Next >

Feedback