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:
In the Project Explorer view,
right-click the model folder, then click Create
Model.
In the Model wizard,
in the Categories pane, click Servicing
Model .
In the Templates pane,
click Blank Services Package.
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:
In the Palette, click Service Contract and
drag the cursor into the diagram editor.
Name the service contract InvoicingContract.
In the Project
Explorer, right-click the InvoicingContract then
click Add Services Modeling > Part and click Unspecified.
In the diagram editor, click the new part in the InvoicingContract element.
On the Properties page,
name the part orderer and specify its type
as InvoiceProcessing interface. This
part represents the requester of the InvoicingService interface.
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.
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:
In the diagram editor, right-click the InvoicingContract service
contract; then click Add Diagram > Activity Diagram ..
Name the diagram diagram and set
the activity to protocol
In the Palette click Partition click
in the activity diagram and name the partition orderer.
In the Properties view, on the General page, click Set,
and specify the orderer part element in the
service contract.
In the Palette click Partition,
click in the diagram, and name the partition invoicing.
In the Properties view, on the General page, click the Set and
specify the invoicing part element in the service
contract.
In the Palette, click Initial node
and drag the cursor to the orderer partition.
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.
In the Select Element dialog box, click the initiatePriceCalculation operation
of the Invoicing interface. The
activity diagram should like the following:
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.
In the Select Element dialog box, click the completePriceCalculation operation
of the Invoicing interface.
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.
In the Select Element dialog box, click the processInvoice operation
of the InvoiceProcessing interface.
The activity diagram should look like the following: