e2e bridge education lesson 2

171
Education Lesson 2 Model-driven integration based on executable UML ® E2E Bridge Base Version 5.1 Release 5.1.3 October 26, 2012 E2E Technologies Ltd Lautengartenstrasse 12 CH-4052 Basel, Schweiz T +41 61 270 97 10 E [email protected] W www.e2ebridge.com

Upload: e2e-bridge-documentation

Post on 29-Oct-2014

397 views

Category:

Documents


0 download

DESCRIPTION

The E2E Education Lessons 1 -3 serve as a self learning program for developing a Web service with E2E Bridge. The education leads you through a development process divided into three lessons, which will teach you to build services based on the E2E Bridge platform. Each lesson can be accomplished in about a day.

TRANSCRIPT

Page 1: E2E Bridge Education Lesson 2

Education

Lesson 2

Model-driven

integration based

on executable UML®

E2E Bridge™

Base Version 5.1

Release 5.1.3

October 26, 2012

E2E Technologies Ltd Lautengartenstrasse 12

CH-4052 Basel, Schweiz

T +41 61 270 97 10

E [email protected]

W www.e2ebridge.com

Page 2: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 2

Table of Contents

1 Introduction ......................................................................................................................................................................... 4

1.1 Documentation Map ..................................................................................................................................................................................................... 5

1.2 Goal of E2E Bridge® Education .............................................................................................................................................................................. 5

2 Extending the Web Service ................................................................................................................................................. 7

2.1 Starting with Lesson 2................................................................................................................................................................................................ 8

2.2 Assignment ..................................................................................................................................................................................................................... 10

3 Use Cases .......................................................................................................................................................................... 11

3.1 Linking UML Elements ............................................................................................................................................................................................. 12

3.2 Extending Use Case Diagram "Product Query Overview" .................................................................................................................. 22

3.3 Creating Use Case Diagram “Insert Product Data into List” ............................................................................................................ 25

3.3.1 Linking UML Elements via Drag & Drop ............................................................................................................................................ 34

4 Building a New Service Structure .................................................................................................................................... 38

5 Classes .............................................................................................................................................................................. 39

5.1 Defining the Classes ................................................................................................................................................................................................. 40

5.2 Defining Dependencies ........................................................................................................................................................................................... 52

5.3 Defining the Currency Calculator ...................................................................................................................................................................... 55

6 Web Service Interface ....................................................................................................................................................... 63

6.1 Defining the Port Type ............................................................................................................................................................................................. 64

6.2 Defining the Operation............................................................................................................................................................................................. 67

6.3 Defining the Operation Parameters................................................................................................................................................................. 69

6.4 Assigning a New Activity Diagram to the Operation .............................................................................................................................. 73

7 Activities ............................................................................................................................................................................ 76

7.1 Adding Parameters to the Activity Diagram ............................................................................................................................................... 77

7.2 Copying UML Elements ............................................................................................................................................................................................ 81

7.3 Mapping Input to Output ......................................................................................................................................................................................... 85

7.4 Using Call Operation Actions ............................................................................................................................................................................... 90

7.5 Using Action Script .................................................................................................................................................................................................... 94

7.5.1 Completing the Object and the Control Flow ................................................................................................................................... 94

7.5.2 Processing the Data Using Action Script........................................................................................................................................... 98

7.6 Implementing the Class Operation ................................................................................................................................................................ 103

8 Component and Deployment Diagrams ......................................................................................................................... 109

8.1 Reworking the Component Diagram .............................................................................................................................................................. 110

8.2 Using the E2E Components Wizard ................................................................................................................................................................ 116

Page 3: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 3

9 Compilation ..................................................................................................................................................................... 122

9.1 Solving Errors ............................................................................................................................................................................................................ 124

10 Testing with E2E Interactive Debugger ......................................................................................................................... 129

10.1 Checking the Services properties ................................................................................................................................................................... 130

10.2 Running the Service ................................................................................................................................................................................................. 131

10.3 Running a Test Case ............................................................................................................................................................................................... 132

10.4 Stepping through the Model with the E2E Interactive Debugger ................................................................................................. 135

10.5 Requesting the Web Service with the Excel Client ............................................................................................................................... 145

11 E2E Server and E2E Console .......................................................................................................................................... 147

11.1 Deploying the Compiled Composite Service ............................................................................................................................................. 148

11.2 E2E Console .................................................................................................................................................................................................................. 151

12 Testing with E2E Analyzer .............................................................................................................................................. 154

12.1 Starting the Service and the Analyzer ......................................................................................................................................................... 155

12.2 Opening a Builder Project ................................................................................................................................................................................... 157

12.3 Test Case Properties .............................................................................................................................................................................................. 160

12.4 Tracing through the Service ............................................................................................................................................................................... 162

13 Glossary ........................................................................................................................................................................... 170

Page 4: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 4

1 Introduction

Page 5: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 5

1.1 Documentation Map

The Bridge is delivered with comprehensive documentation. Apart from this self-study, the Bridge also comes with many

examples you can have a look at. Each feature is subject of an example that is ready to run.

This chapter provides an overview about all documentation available after installation. If you did not change the default

location of the E2E documentation, you will find all documents and examples in folder C:\E2EBridgeDocumentation_5

\Documentation.

Additionally, all documentation is available online at the E2E Homepage.

Document Content

E2E Bridge Education Lesson 1-3

(this document)

Comprehensive self-learning guide, which leads you through all steps of creating

a Web Service. Additionally, it provides conceptional information for each topic.

E2E Bridge Reference Guide Comprehensive Bridge guide containing information about architecture, concepts,

modeling, E2E Action language, add-ons, and import/export mechanisms.

E2E Bridge Server User Guide Comprehensive guide explaining concepts and usage of E2E Console, which

comprises all management tasks to run the Bridge and deployed composite

services.

E2E Bridge Builder User Guide Comprehensive guide explaining concepts and usage of E2E Builder including all

tools like E2E Model Compiler, E2E Model Debugger, and E2E Importers.

E2E Bridge Server Installation Guide Description of the installation of E2E Console including a troubleshooting chapter.

This guide also contains a description of the following firmware installations:

E2E SQL Libraries to integrate SQL databases

E2E SAP Libraries to integrate SAP systems

E2E Java Libraries to use Java classes in your service

E2E Bridge Builder Installation

Guide

Description of the installation of E2E Builder including a troubleshooting chapter.

E2E Analyzer Installation Guide Description of the installation of E2E Analyzer.

Page 6: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 6

1.2 Goal of E2E Bridge® Education

This document is one of three documents, which serves as a self learning program for developing a Web service with E2E

Bridge. The education leads you through a development process divided into three lessons, which will teach you to build

services based on the E2E Bridge platform.

Welcome to lesson 2 of the E2E Education. By working through this document, you will learn

how to create classes and associations

how to use objects and pins

how to use operations and functions in action scripts

how to define call operation actions

how to perform simple mappings

how to test and debug your own Web service with the E2E Interactive Debugger and the E2E Analyzer

The goal of this lesson is to create a Web service that receives data entered in an input mask of an Excel client. The Web

service processes the data and returns it back to the client, where it is displayed in the spreadsheet.

Page 7: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 7

2 Extending the Web Service

The UML model you created in the first lesson serves as a base for the modeling in lesson 2. In lesson 1, the Excel client

sends a string to the Web service. It gets returned to the Excel spreadsheet where it is displayed as a title in uppercase

letters. In this lesson, you will extend this service.

In the first lesson, the development process was discussed. Below, you find the components and steps of a logical design

process:

1. Use cases (roles and their activities)

2. Classes (static data structure)

3. Web service interface (port type definition for modeling the interface with its operations)

4. Activities (choreography, system behavior, backend adapters)

5. Sequences (system behavior)

6. Components and deployments

7. Compilation of UML models with the E2E Model Compiler

8. Debugging and testing the services with the E2E Interactive Debugger and the E2E Analyzer

9. Deployment of E2E composite services to an E2E Server

You will also follow these design steps in lesson 2.

Page 8: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 8

2.1 Starting with Lesson 2

Note: In MagicDraw, all UML models respectively XMI files are called project. You can open them without having E2E

Builder installed. However, working with the Bridge, all UML models, which belong to your software project, are

organized within a Builder project, which has its own settings. To work with E2E Bridge models, you need to open a

Builder project first in order to edit, compile, and deploy the contained UML models. Not opening a Builder project

results in disabled Builder menus.

All models are located in the uml folder of the Builder project.

Start MagicDraw™ and choose the menu item

E2E Builder > Open Project to open the Builder

project Education.

The last UML® model that was saved in the

current Builder project prior to closing

MagicDraw will always be opened automatically.

If not, choose the example lesson1.xml as shown

in the picture on the left.

Page 9: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 9

To keep the UML model of lesson 1 as a reference, save the file lesson1 as lesson2 by clicking File > Save Project As….

Rename the File name to lesson2. The UML

model will be saved in format XMI 2.1.

Click the Save button.

Note the changed deployment information in the

Model Compiler window.

Page 10: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 10

2.2 Assignment

In lesson 2, you will extend the Web service of lesson 1. You will learn to use input and output objects, to write simple

action scripts, to define simple mappings, and to use call operation actions and pins.

You will reuse some elements of the Web service you modeled in lesson 1. The data that is entered in the search mask of

the Excel client will be sent to the Web service. The Web service will return the same data to the Excel spreadsheet where

it is displayed as shown below.

This is the basic functionality to develop a search mechanism, which is the goal of the third education lesson.

Page 11: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 11

3 Use Cases

First, you will update the use case diagrams to consider the new functionality of the Web service.

Page 12: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 12

3.1 Linking UML Elements

In the containment tree, navigate to the use case

diagram Product Query Overview in the package Data

/ Overview / Use Cases, and double-click it to open it.

Right-click the tab of Product Query Overview and select Close All Diagrams But Current. This will close all open diagrams

except the use case diagram Product Query Overview.

Page 13: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 13

You already drew a more detailed use case diagram for the first use case Define Title in lesson 1. Now, you will link the use

case Define Title to this use case diagram Define a Title. This facilitates navigating through the model and makes complex

models easier to understand.

Page 14: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 14

Select the use case Define Title with the right mouse button and choose Specification from the context menu as shown

below.

Page 15: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 15

The UseCase Specification dialog opens. Select

the entry Documentation/ Hyperlinks in the

left panel.

Page 16: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 16

Click Add to insert a hyperlink.

Change to the tab Element/Symbol to select a

UML diagram.

Page 17: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 17

To choose a diagram of your UML model, click

the button ... .

The containment tree with a collection of UML

models is listed.

Page 18: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 18

Select the use case diagram Define a Title.

Click OK.

The selected diagram is displayed in the field

Select element/symbol.

Click OK.

Page 19: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 19

The hyperlink to the use case diagram Define a

Title is set.

Click Close .

When selecting a UML element, it shows the symbol to add a hyperlink. If a hyperlink has been added to a use case

symbol, the icon of the target diagram will be embedded in the UML symbol (if the UML element has not the focus).

The use case Define Title is linked to use case diagram Define a Title now. Whenever you double-click a UML element

having defined a hyperlink, the linked diagram will open.

Note: After changing any element in MagicDraw, the color of its corresponding entry in the containment tree will

change to blue. When you save the model, the color will turn to black again.

Page 20: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 20

Double-click the use case Define Title either on the diagram pane or in the containment tree in the package Data /

Overview / Use Cases. The linked use case diagram opens.

Clicking the navigation icon in the menu bar once, will

bring you back to the top level use case diagram.

Page 21: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 21

Page 22: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 22

3.2 Extending Use Case Diagram "Product Query Overview"

You now will extend the use case diagram Product Query Overview considering the additional functionality of the Web

service.

In order to draw another use case, you will use a different technique. Select the Use

Case symbol from the diagram toolbar, place it on the diagram pane, and start

immediately typing the name Insert Product Data into List. Then, press Ctrl - Enter to

finish entering the use case name.

Rearrange the UML elements on the diagram pane as shown below.

Page 23: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 23

Draw an association between the actor Consumer and the use case Insert Product Data into List.

Page 24: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 24

Save the UML model.

Page 25: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 25

3.3 Creating Use Case Diagram “Insert Product Data into List”

Select the package Data / Overview / Use Cases with the right mouse button and create a new package as shown below.

Page 26: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 26

Assign the name Insert Product Data Service.

Select the package Insert Product Data Service with the right mouse button and create a new use case diagram as shown

below.

Page 27: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 27

Page 28: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 28

Name the use case diagram Insert Product

Data into List.

You will now add the actor and the use cases to the new use case diagram Insert Product Data into List. Reuse the actor

Consumer from package Data / Overview / Use Cases.

Page 29: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 29

Drag and drop the actor Consumer onto the

use case diagram Insert Product Data into List

in the diagram pane.

Page 30: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 30

Draw the detailed use case diagram for lesson 2 by choosing the appropriate icons

from the diagram toolbar.

Draw a use case and name it Insert Product Data into List.

Page 31: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 31

Add the use cases Enter Product Data and View Product Data.

Page 32: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 32

Draw an Association between the actor Consumer and the use case Insert Product Data into List.

Page 33: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 33

Draw Include relations between the use case Insert Product Data into List and the other use cases.

Page 34: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 34

3.3.1 Linking UML Elements via Drag & Drop

Linking UML Elements is also possible via drag & drop. You will now link the new use case diagram Insert Product Data

into List to the corresponding use case in the overview diagram Product Query Overview.

Switch to the diagram Product Query Overview.

Page 35: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 35

Page 36: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 36

You will now use a different technique to link

diagrams. In the containment tree, navigate to

the use case diagram Insert Product Data into

List.

Drag the diagram element from the containment

tree to the use case Insert Product Data into List

on the diagram pane until the UML element gets

surrounded by a blue rectangle. Release the

mouse button.

Page 37: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 37

The use case Insert Product Data into List now is

linked to use case diagram Insert Product Data

into List and shows the icon .

Save the UML model.

Page 38: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 38

4 Building a New Service Structure

For the second Web service, you need to rework the service structure in order to take into account different names. This is

recommended to keep the model maintainable. In the containment tree, navigate to the package Data / Services /

GetTitleService. Click it with the right mouse button and choose Rename.

Rename the package to GetProductService.

More reworking will be done later.

Page 39: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 39

5 Classes

In the next modeling step, you will learn how to model data structures. You will start modeling a class that stores input

data of the new Web service. Data structures are modeled with classes that are visualized in class diagrams. Objects,

which are instances of these classes, will be used during the modeling process in activity diagrams.

Page 40: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 40

5.1 Defining the Classes

In the containment tree, select the Classes package with the right mouse button and select New Element > Class.

The new class will store data that is entered by

the actor in the Excel client. A data record

represents a product.

Assign the name InputProductRecord to the

new class.

In the next step, you will define the properties of the new class by adding attributes. Select the class with the right mouse

button and select New Element > Property as shown below.

Page 41: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 41

Assign the name title to the first attribute of the

new class.

Page 42: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 42

Now, define the new attribute to be of base type

String. Double-click the attribute node in the

containment tree to open the Property

specification dialog. Click into the Type field and

start typing str on the keyboard to filter the list.

Select String [Base Types] with the arrow keys

and press Enter .

Note: Always make sure to select the E2E base types and not the types that are part of the UML standard

profile (see String [UML Standard Profile...] in the Type field.

Click the pull-down menu Visibility and select

public. Public attributes can be read and modified

in activities defined outside the class.

Page 43: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 43

Do not change any other settings and close the

dialog.

You will now add the other attributes directly in

the Class specification dialog. Select the class with

the right mouse button and select the menu item

Specification.

Page 44: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 44

Click the item Attributes in the left navigation

panel.

The Class specification dialog shows all class

attributes in form of an editable table. The

previously defined attribute title is visible, too.

Click the Create button to add another attribute.

Enter the attribute name category, set the type to

String, and the visibility to public.

Click the Back button to return to the attribute list.

The second class attribute is defined now.

Page 45: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 45

Now, add the following attributes to the class. Pay attention to correct spelling.

Name Type Visibility

manufacturer String public

seller String public

sellerType String public

priceUSD Float public

link String public

The class InputProductRecord with seven

attributes is completed. Click the Close button.

The new attributes are listed in the containment

tree as well.

In the next modeling step, you will draw the previously defined class in the diagram pane. Select the package Classes in

the containment tree and create a new Class Diagram as shown below.

Page 46: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 46

Assign the name Product Query Classes to the

new class diagram. The new class diagram will

be opened in the diagram pane.

Select the InputProductRecord class in the containment tree and drag and drop it onto the diagram pane.

Page 47: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 47

Now, the class with its attributes and attribute types is displayed on the diagram pane. The + sign in front of each attribute

indicates that their visibility is public.

Page 48: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 48

Each instance of the class represents a product. You have defined the attribute priceUSD in the class InputProductRecord.

Later in the example, you will convert the price for each product into another currency. In order to perform this calculation,

you will use exchange rates that are provided by another class, you will define later on.

The result of the currency calculation will be stored in an output class identically equal to InputProductRecord, but this

class will have additional attributes to store the converted price in CHF and the exchange rate.

The easiest way to create the output class is to copy and modify the input class.

Page 49: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 49

Navigate to the InputProductRecord class in

the containment tree, select it with the right

mouse button, and click Copy.

Then, select the package Classes with the right

mouse button and click Paste.

Page 50: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 50

The new inserted class automatically gets

assigned the name of the copied class, with the

figure 1 appended to it: InputProductRecord1.

Double-click the class InputProductRecord1 and

rename the class to OutputProductRecord.

Switch to the tab Attributes.

Page 51: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 51

Click Create and add the following attributes.

Name Type Visibility

priceCHF Float public

exchangeRate Float public

Add the new class to the class diagram, which afterwards should look like shown in the picture below.

Save the UML model.

Page 52: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 52

5.2 Defining Dependencies

The Web service will return the input product data and additionally the converted price in CHF and the applied exchange

rate.

By defining Dependencies between the attributes of the input and output class, the input data can easily be mapped to the

output data. Thereby, the direction of the Dependency defines the direction of the information flow. Later, when

implementing the behavior of the service in the activity diagram, you will initiate this mapping by using the <<Mapping>>

stereotype in an action.

Choose a Dependency from the diagram

toolbar.

Move the mouse over the first attribute category

of class InputProductRecord until the blue

activation frame appears.

Page 53: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 53

Left-click and drag the dependency line to the

corresponding attribute category of the other

class OutputProductRecord. When the blue frame

appears, click again to draw the dependency.

The Dependency arrow may not be drawn as a

straight line as shown in the example on the left.

You can reroute the arrow by clicking and

dragging the black handles of the line.

Alternatively, you can already route the path of

the arrow while drawing it (see next step).

Choose another dependency from the diagram

toolbar. Click the attribute title of class

InputProductRecord.

On your way to attribute title of class

OutputProductRecord click on the diagram pane

to curve the line.

Draw dependencies from all InputProductRecord attributes to the corresponding attributes of class OutputProductRecord.

Now, the class diagram should look like shown in the picture below.

Page 54: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 54

Save the UML model.

Page 55: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 55

5.3 Defining the Currency Calculator

The currency calculator will be implemented in a separate class. In lesson 3, you will extend this class to call an external

Web service.

In order to create the class, you will use a

different technique.

Select the icon Class from the diagram toolbar

and place it on the diagram pane. Immediately,

start typing the name CurrencyCalculator.

Then, press Ctrl - Enter to finish entering the

class name.

The class CurrencyCalculator will have a class operation that will contain the implementation of the currency calculator. It

does not need to have any attributes, yet. Select the class in the containment tree an choose New Element > Operation

from the context menu.

Page 56: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 56

Enter the name getExchangeRate.

Double-click the Operation in order to open the

Specification dialog. Select the checkbox Is Static

to set this option to true.

If you call class operations, you normally have to

create an instance of a class. This instance is

used to make the operation call. If a class

operation is defined static, it is not necessary to

create a class instance. Static operations can be

called directly in the action script.

The operation will return the exchange rate

CHF/USD.

Switch to the Parameters tab and click Create .

Select Parameter from the drop down list.

Page 57: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 57

Assign the name exchangeRateCHFUSD, the type

Float [Base Types], and set the direction to out as

the operation will return this parameter.

Click Close .

After creating this class, the class diagram should look like shown in the picture below.

Activities implement the behavior of operations. Each class operation has to be assigned to its implementing activity

diagram. When the operation is called, the assigned activity diagram will be executed.

The activity diagram implementing the class operation getExchangeRate has not been created yet. In the next step, you will

directly assign a new activity diagram to the operation getExchangeRate.

Select the operation getExchangeRate in the containment tree with the right mouse button and choose Behavior Diagram >

Assign….

Page 58: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 58

The Assign Behavior Diagram dialog displays a

list of existing activity diagrams that can be

assigned to the operation. However, this

operation gets assigned a new activity diagram.

Click the New button.

Page 59: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 59

Choose Activity Diagram from the drop down list.

The new activity diagram is now listed in the

Assign Behavior Diagram dialog.

MagicDraw automatically creates an activity

diagram and gets the name from the context of

the operation: CurrencyCalculator. It is displayed

in bold indicating that this is the activity diagram

assigned to the operation.

Click Close .

Page 60: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 60

Expand the activity CurrencyCalculator in the

containment tree. The activity has been created

automatically and contains the activity diagram

having the same name.

MagicDraw uses the activity diagram name as

default name for the activity. Furthermore, all

parameters and activity parameter nodes are

created automatically, according to the class

operation parameters.

As the name of an activity should always

correspond to the operation it specifies, select

the activity CurrencyCalculator in the containment

tree and rename it to Get Exchange Rate.

Page 61: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 61

Note that MagicDraw renamed the corresponding

activity diagram as well.

The created activity diagram is displayed in the diagram pane.

Page 62: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 62

Note: If you double-click the operation getExchangeRate in the containment tree, the assigned activity diagram

CurrencyCalculator will always be opened in the diagram pane.

The implementation of the operation getExchangeRate will be explained later in chapter Activities.

Save the UML model.

Page 63: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 63

6 Web Service Interface

All “public” Web services, which clients may access, must have a port type definition. A port type accumulates Web service

operations that a client can call. In the UML model, port types will be designed by using a class stereotyped as port type.

This special kind of class is called port type and has no attributes but only operations. Each operation must be assigned to

an activity diagram of the UML model. Operations of a port type represent the interfaces of a Web service. Activities

implement the behavior of these operations.

Within a Web service, one or more services can be included. Each service can have one or more port types. Within a port

type, one or more operations having input and/or output parameters can be defined. Port types are the SOAP interface to

the outside world.

In the next development step, you will create the SOAP interface of the Web service. In lesson 1, the SOAP Interface

structure was already predefined via the E2E model template you used. Therefore, in order to learn how to create a new

SOAP interface from scratch, you will not copy or rework the interface of lesson 1.

Page 64: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 64

6.1 Defining the Port Type

In the containment tree, navigate to the

package Data / Services / GetProductService /

Ports, and create a new class.

Name the port type GetProductPortType.

Page 65: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 65

Click the new port type in the containment tree

with the right mouse button and select

Stereotype from the context menu. Another menu

opens, containing a text field and a list of

stereotypes. Port types need the stereotype

E2ESOAPPortType. In order to locate it in the list

of stereotypes you can filter the list by entering

the initial letters of the stereotype name, for

instance e2es. Select the checkbox next to the

stereotype E2ESOAPPortType and confirm your

choice with the Apply button.

Note, that the icon of class GetProductPortType

has changed to a port type icon after assigning

the stereotype.

Page 66: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 66

Double-click the GetProductPortType and

navigate to the Documentation/Hyperlinks

section in the left panel of the dialog.

In the Documentation field, enter a description of

the port type:

The port type provides an operation to copy a title

string and a product record. The data is displayed

in the client application.

Click Close .

Page 67: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 67

6.2 Defining the Operation

Create an operation for the new port type.

Assign the name getProduct.

According the SOAP standard, operations of port types needs to defined as static. In the object-oriented world this means

that no instance of the port type class is needed to call the operation. The operation can be called directly without

instantiating the port type class (more details are described in the following chapters).

Page 68: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 68

Double-click the new operation getProduct to

open the operations specification dialog. Select

the checkbox Is Static to set this option to true.

Switch to the Documentation/ Hyperlinks section,

and enter a description in the Documentation

field:

The operation defines an interface to copy a title

string and a product record.

The title string is converted to upper case. An

object containing product data is passed in.

Another object with additional attributes

containing a converted price to another currency

and the exchange rate is returned.

Click Close .

Page 69: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 69

6.3 Defining the Operation Parameters

The Web service will be capable of taking a record from the actor via the Excel client and passing this data back to the

actor. A data record represents a product. So, the service needs additional operation parameters: one input parameter

(inputProductRecord) and one output parameter (outputProductRecord). As the new port type operation will still convert the

title string, too, it also needs the parameters inputTitle and outputTitle.

For the title parameters, the most efficient way

is to copy the parameters in the containment

tree from the lesson 1 port type

GetTitlePortType to the new port type.

Expand the tree of port type GetTitlePortType

and its operation getTitle and select the two

parameters inputTitle and outputTitle.

Page 70: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 70

Next, keep the Ctrl key pressed and drag the two

parameters to the operation getProduct.

Holding down the Ctrl key tells MagicDraw to

copy the parameters instead of moving them

from one operation to the other. A +-sign

attached to the cursor arrow indicates the copy

action.

Release the mouse button when the operation getProduct is active. MagicDraw will create an exact copy of the operation

parameters.

Note: Using this method, MagicDraw not only copies the parameter names, but also copies all the parameter

properties like type and direction.

Create a third operation parameter.

Page 71: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 71

Assign the name inputProductRecord.

Double-click the parameter inputProductRecord

to open the Parameter specification dialog.

Click into the Type field and start typing inp in

order to filter the list. Select the previously

defined class InputProductRecord.

Page 72: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 72

As this parameter is used as input to the

operation, the Direction has to be set to in.

Close the dialog.

Finally, create another parameter, name it

outputProductRecord, and choose the type

OutputProductRecord. Specify the parameter as

an output parameter.

Page 73: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 73

6.4 Assigning a New Activity Diagram to the Operation

At this point, the interface of the Web service is nearly complete. Each operation must be assigned to an activity diagram of

the UML model. Operations of a port type represent the interfaces of a Web service. Activity diagrams implement the

behavior of these operations. Thus, each port type operation has to be assigned to the implementing activity diagram.

When the operation is called, the assigned activity diagram will be executed.

The activity diagram has not been created yet. In the next step, you will directly assign a new activity diagram to the

operation getProduct.

Select the operation getProduct in the

containment tree with the right mouse

button, choose Behavior Diagram, and select

the menu item Assign….

The Assign Behavior Diagram dialog displays a

list of existing activity diagrams that can be

assigned to the operation. However, the

operation gets assigned a new activity diagram.

Click New and select Activity Diagram from the

drop down list.

Page 74: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 74

MagicDraw automatically creates an activity

diagram and gets the name form the context of

the opereation: GetProductPortType.

The new activity diagram GetProductPortType is

now listed in the Assign Behavior Diagram

dialog and is assigned to the operation.

Click Close .

Expand the activity GetProductPortType in the

containment tree. The name of the activity

respectively the activity diagram should always

correspond to the name of the operation it is

specifying.

Rename the activity to Get Product. MagicDraw

will rename the activity diagram as well.

Page 75: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 75

Note: If you double-click the operation getProduct in the containment tree, the assigned activity diagram Get Product

will be opened in the diagram pane.

The definition of the second SOAP interface of the Web service is completed.

Save the UML model.

Page 76: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 76

7 Activities

The next step in the development process is to model the implementation of the operation getProduct. At the end of this

chapter, your activity diagram will look like the following:

Page 77: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 77

7.1 Adding Parameters to the Activity Diagram

The activity diagram Get Product will contain actions to define an exchange rate and to receive and process input data.

Objects represent object flow through activities and can change their state. Objects may originate outside of the context of

an activity diagram – in other words, they are input parameters to the activity diagram. On the other side, activity diagrams

may produce objects that are used as output. They can be passed as output parameters to an outside context, which can be

a calling activity diagram or a port type operation.

In the last chapter, you defined the operation getProduct, its parameters, and the implementing activity diagram. Now, you

will add the two parameters to the activity diagram in the diagram pane to model the object flow. Remember that each

activity parameter node works as a container of a parameter. They have a different color than normal object nodes that are

drawn in the activity diagram and indicate that these nodes contain activity parameters. In order to visualize input and

output parameters, you can place them on the left or right side of the diagram frame. The left side corresponds to input, the

right side to output.

Select the parameter inputTitle in the containment

tree.

Page 78: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 78

As it is an input parameter, drag the selected

parameter to the left border of the diagram frame

until the diagram frame gets surrounded by a

blue rectangle.

Release the mouse button.

Note: Although you were dragging the

parameter and not the activity

parameter node from the containment

tree, MagicDraw placed the activity

parameter node on the activity

diagram.

The input activity parameter node has been drawn in the activity diagram and is displaying the name of the parameter

it is containing. On the right side of the colon, the type of parameter (String) is displayed.

Page 79: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 79

Now, add the output parameter to the activity

diagram.

Select the parameter outputTitle in the

containment tree.

As it is an output parameter, drag the selected

parameter to the right border of the diagram

frame until the diagram frame gets surrounded by

a blue rectangle.

Page 80: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 80

Release the mouse button. The output activity

parameter node has been drawn in the activity

diagram and is displaying the name of the

parameter it is containing.

In the lower left corner of MagicDraw, next to the

E2E Model Compiler, you can find the Zoom tab.

The blue frame marks the section of the diagram

you are currently viewing in the diagram pane.

You can shrink or enlarge the section by dragging

the little blue handles in the corners of the blue

frame.

In order to get a better overview, click the big white rectangle to automatically resize the diagram section. Now, the whole

diagram fits into the diagram pane.

Page 81: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 81

7.2 Copying UML Elements

Before implementing the new functionality, you will copy some UML symbols from the port type operation diagram Get

Title to the new port type operation diagram Get Product.

In the containment tree, navigate to the

activity diagram Get Title, which has been

created in lesson 1. Double-click it to open it in

the diagram pane.

Select the items as shown in the picture on the

left while holding down the Shift key: the initial

node, the action node Get Title, and the final node.

Press Ctrl - C on your keyboard to copy them to

the clipboard.

Switch back to the activity diagram Get Product

by clicking the Previous Diagram icon from the

MagicDraw menu toolbar.

Page 82: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 82

Paste the copied items with Ctrl - V . Note that

MagicDraw copied the control flows, too, although

they were not selected.

Note: Copying UML symbols from one diagram to another results in duplicate elements in the containment tree with

the same name. The duplicated elements exist twice, in the activity tree of the source diagram as well as in the

activity tree of the target diagram.

Copying UML symbols within the same diagram only results in copying the graphical element - the symbols. The

same symbol appears twice in the diagram pane, but the UML element in the containment tree only once. Symbols

are only representations of the UML elements in the containment tree. Deleting the UML element in containment

tree would remove all symbol representations in the diagram pane.

In order to create a duplicate UML element within the same diagram, paste the copied symbol with Edit - Paste with

New Data or Ctrl - E . In this case, MagicDraw will not only create a new symbol with a new name but also a new

element in the containment tree.

Rearrange the UML symbols and delete the

control flow between the action node Get Title

and the final node.

Page 83: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 83

When deleting the control flow, MagicDraw asks

wether to delete the UML element from the

model, as it is not used anymore. This means that

not only the symbol in the diagram pane but also

the UML element from the containment tree is

deleted. Selecting a symbol and pressing Ctrl -

D would remove everything in one step without

asking.

Click Yes .

Click the activity parameter node inputTitle and

select Object Flow from the smart manipulation

toolbar. Draw an object flow to the action node

Get Title.

Draw an object flow from action Get Title to

parameter outputTitle.

Page 84: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 84

Save the UML model.

Page 85: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 85

7.3 Mapping Input to Output

At the beginning of the modeling phase of this Web

service, you defined the classes for the input and

output data structures.

Remember that by defining dependencies between the attributes of the input and output class, the input data can easily be

mapped to the output data.

Now, you will initiate this mapping by using the <<Mapping>> stereotype in an action. This action then will internally

translate the declarations defined in class diagrams into a set of action script statements that actually execute the

mapping. Later on in this lesson when tracing the compiled service with the E2E Analyzer, you can see this in more detail.

The input and output objects will be added to the diagram as parameters.

Page 86: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 86

Select the Control Flow icon from the smart

manipulation toolbar and draw an action node

below Get Title. MagicDraw draws both the

control flow and the action node.

Start directly typing the action node name Map

Product Record Data. Finish the entry with Ctrl -

Enter .

Page 87: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 87

Add the parameters inputProductRecord and

outputProductRecord to the diagram. Select them

in the containment tree (below the activity Get

Product) and drag them to the frame borders of

the diagram pane.

Select the action node Map Product Record

Data with the right mouse button and choose

Stereotype.

Start typing ma to filter the list. Select Mapping

and click Apply .

Page 88: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 88

The stereotype <<Mapping>> specifies the action

Map Product Record Data as a special action

having no action script. The mapping stereotype

is indicated by the icon in the upper left

corner of the action node.

The data mapping is done as defined in the class

diagram Product Query Classes. The involved

classes are identified by the object flows

connected to this mapping action.

Click the parameter inputProductRecord and

select Object Flow from the smart

manipulation toolbar.

Draw an object flow from parameter

inputProductRecord to action Map Product

Record Data.

As the currency conversion is not done yet, the output data of the mapping action will not flow directly to the output

parameter outputProductRecord, but will be temporarily stored in a Central Buffer Node. This UML symbol is used to store

information only within the activity diagram. The information is not passed outside the context of the activity diagram.

Page 89: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 89

Click the action Map Product Record Data and

select Object Flow from the smart

manipulation toolbar.

Click the diagram pane next to the action node

Map Product Record Data to create a central

buffer node. Action node and central buffer node

will be connected by an object flow automatically.

Double-click the object to open the specification

dialog.

Assign the name outputProductRecord and select

the type OutputProductRecord from the type list.

Remember that the list can be filtered by typing

the initial characters in the field Type.

Note, that the object has the same name and type

as the parameter.

Click Close .

While the central buffer node is used for the object flow within the context of the activity diagram, the activity parameter

node is used to pass the data to the outside context. The object flow only leads to the parameter node when the object

outputProductRecord does not change its state anymore. Here, this will be right after the currency calculation that is

implemented in the next chapter.

Save the UML model.

Page 90: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 90

7.4 Using Call Operation Actions

In the next step, you will call a class operation in order to get the exchange rate for CHF / USD. The operation

getExchangeRate is a member of class CurrencyCalculator. The operation returns a parameter called

exchangeRateCHFUSD being of type Float. In UML, operations are called using Call Operation Actions.

Click the action node Map Product Record Data

and select Control Flow from the smart

manipulation toolbar.

Move the mouse cursor down, but this time click

the right mouse button. A list of possible UML

symbols appears.

Choose Call Operation Action.

Page 91: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 91

In the Select Operation dialog, filter the list by

typing getExch and select the operation

getExchangeRate.

Click OK.

Call operation actions and call behavior actions

may have input and output pins. An input pin is a

pin that holds input values to be consumed by an

action. An output pin is a pin that holds output

values produced by an action.

In the Select Pins dialog, click OK.

The call operation action node is displayed in a different color than normal actions. It visualizes an action calling an

operation. The name of the called operation is displayed in the call operation action node.

As the operation getExchangeRate has the output parameter exchangeRateCHFUSD, an output pin is docked to the

action node. Name and type of the object is displayed next to the pin.

Page 92: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 92

An output pin holds output values produced by an action. The value can be delivered to other actions via object flows. At the

same time, objects can be transformed to other objects having a different name using pins. This increases modeling speed

and helps avoiding modeling errors (see also chapter Transformations in the E2E Reference Guide). It would be equivalent

to use a central buffer node instead of a pin, however, it is best practice to use pins in this case.

Page 93: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 93

As it is an output pin and in order to visualize the

information flow, we recommend dragging the

input pin to the right border of the call operation

action node.

Save the UML model.

Page 94: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 94

7.5 Using Action Script

In the next (and last) action, you will use the float exchangeRateCHFUSD, which was received from operation

getExchangeRate, in order to convert the price in USD to the price in CHF. The price in USD was taken from the input object

(inputProductRecord) and has already been mapped to the object outputProductRecord. In the next step, you will update

this object with the calculated price in CHF and the exchange rate, before the object is returned to the calling client.

7.5.1 Completing the Object and the Control Flow

Before editing the action script of the next action, you will first complete the control and the object flow. Having completed

the object flow you get full editing support of the Action Script Editor.

Select the call operation action

getExchangeRate and choose Control Flow from

the smart manipulation toolbar.

Page 95: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 95

Draw a new action node and immediately start

typing its name Set Price CHF and Exchange Rate.

The new action Set Price CHF and Exchange Rate needs some input data: the exchange rate and the output product record

data, which has to be updated.

Select the output pin exchangeRateCHFUSD and

choose Object Flow from the smart manipulation

toolbar.

Page 96: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 96

Draw a object flow from the output pin to the new

action node Set Price CHF and Exchange Rate.

Now, draw an object flow from the central buffer

node outputProductRecord (to which the input

product record data had been mapped) to the new

action node as well. This is required, as the action

needs the reference to this object in order access

and update its attributes.

Now, the processed data must be passed to the output parameter.

Page 97: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 97

Draw an object flow from action node Set Price

CHF and Exchange Rate to the output parameter

outputProductRecord.

Finally, complete the control flow by connecting

Set Price CHF and Exchange Rate to the activity

final node.

Page 98: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 98

7.5.2 Processing the Data Using Action Script

In the next modeling step, you will define the action script of the action Set Price CHF and Exchange Rate. Within this action

script, you will set the exchange rate to the output parameter and perform the currency calculation.

Click the action node Set Price CHF and

Exchange Rate with the right mouse button

and select Action Script Editor from the

context menu.

The E2E Action Script Editor opens.

Page 99: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 99

Remember that you defined the attribute

exchangeRate in class outputProductRecord.

Although the Action Script Editor is open, you can

check the class attributes in between.

Select the central buffer node

outputProductRecord and select Go To > Type

OutputProductRecord from the context menu.

The class definition of OutputProductRecord gets

selected in containment tree.

Expand the tree to view all attributes of

OutputProductRecord.

In the meantime, the Action Script Editor stays

open. Continue working in the Action Script Editor

now.

You can reference the attribute exchangeRate of class outputProduct-Record by writing the object name followed by a dot

and the attribute name (outputProductRecord.exchangeRate). Use the set assignment statement in order to

assign a value to an attribute being of a base type (here Float).

Page 100: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 100

Adding a space after set lists all available

objects of the current action. Select the object

outputProductRecord and press Return .

Now, you need to reference the attribute

exchangeRate of the object outputProduct

Record.

After adding a dot behind the object name, all

attributes of the object (blue) and all available

operations (green) will be listed. The list of

operations contains the operations of a

corresponding base class (for instance a String)

as well as Any Type Operations (operations that

are applicable to any possible type).

Select the attribute exchangeRate.

The notion exchangeRate:Float in the suggestion list indicates that the attribute is of base type Float.

Note that an equal sign (=) has already been

added after entering set.

Go to the end of the line and press Ctrl - Space

to force the list of suggestions for possible

input objects. Select exchangeRateCHFUSD.

Page 101: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 101

Note: If Action Script Editor does not offer you the accessible objects automatically, you can force the list of

suggestions by pressing Ctrl - Space .

Every action script statement has to be finished

with a semicolon (;), which you have to add to

complete the statement.

In the second action script statement, you will perform the currency calculation. The price in USD will be converted to the

price in CHF. You will use arithmetic operators in the set assignment statement and assign the value of attribute

priceUSD multiplied with the value of object exchangeRateCHFUSD to the value of attribute priceCHF.

Enter the following action script using the script editing features.

set outputProductRecord.priceCHF = outputProductRecord.priceUSD * exchangeRateCHFUSD;

Note: The factor exchangeRateCHFUSD is known within the action script as it was passed into the action node via

the output pin of call operation action getExchangeRate.

The action script is complete.

Press the Ctrl - Enter keys to close the Action

Script Editor.

The action script is now shown in the tagged value script within the action node Set Price CHF and Exchange Rate. Note

that the stereotype <<ActionScript>> was applied to the action node as well.

Page 102: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 102

Save the UML model.

Next, you will implement the class operation getExchangeRate().

Page 103: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 103

7.6 Implementing the Class Operation

Besides attributes, there are operations that are defined on classes. Basically, these operations can be called within a

service instance but not externally by other processes, clients, etc. However, if you like to publish class interfaces, for

instance as Web service interfaces, you can give the class the stereotype <<E2ESOAPPortType>>. A port type accumulates

operations that a client can call on a Web service. If you want to publish other interfaces like SAP RFC modules or HTTP

operations, the Bridge provides other appropriate stereotypes.

In chapter Classes you defined the class CurrencyCalculator, which has no attributes and one operation getExchangeRate.

The operation getExchangeRate is defined as static. That means, no instance of the class has to be created to use the

operation. In chapter Using Call Operation Action, you directly called this operation in the activity diagram via the Call

Operation Action, in order to get the exchange rate for the currency conversion.

Now, you will implement this operation in the activity diagram, you already defined before. It is already assigned to the

class operation getExchangeRate. The activity diagram is located in the containment tree directly within the class element.

Navigate to the activity diagram Get Exchange Rate (in Data - Services - GetProductService - Classes - Currency

Calculator) and open it.

Now add the required diagram components. Add the following to the diagram pane:

an initial node

an action node

and an activity final node

The most effective way to draw this is described below.

First, add an initial node to the activity diagram.

Just after drawing the UML element start

typing a name. Assign the name Start.

Page 104: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 104

Select the initial node and choose the Control

Flow icon from the smart manipulation

toolbar.

Drag the control flow downward and right-click

on the diagram pane below the initial node.

From the context menu, select Action as node

type the control flow is leading to.

Page 105: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 105

Assign the name Define Exchange Rate.

Select the action node and draw another Control

Flow again. As ending point of the control

flow select Activity Final.

Assign the name End.

Page 106: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 106

The activity diagram should look like this.

Note: Giving initial and final nodes a name makes maintaining and debugging the Web service easier, as they can be

identified via its name. Especially if there are more ending points in the same diagram we recommend giving them a

name. Note that the names are displayed in the containment tree now.

Select the parameter exchangeRateCHFUSD in

the containment tree.

As it is an output parameter, drag it on the

diagram pane on the right border of the

diagram.

Draw an object flow from the action node to

the output parameter.

Frequently, it is necessary to store literals global to a Composite service. In the Bridge context, it is possible to define name

value pairs that are configurable by the E2E Embedded Server respectively the E2E Console. These name value pairs are

called settings.

Page 107: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 107

For the moment, you will hard code the exchange rate as a fix value that can be edited via the composite service settings.

In lesson 3, you will extend the service by implementing a call to an external Web service in order to get the exchange rate.

Open the Action Script Editor and start with

the set assignment statement:

set exchangeRateCHFUSD =

After the equal sign, type s and open the

suggestion list with Ctrl - Space . Select the

second setting statement offered as you

want to assign a float value.

Replace the name parameter by "exchange

rate CHF - USD". Replace defaultValue

by, for instance, 1.0658.

This statement will create a configurable setting

of the composites service, whose value is

assigned to the variable exchangeRateCHFUSD.

Finish the statement with a semicolon and close

the Action Script Editor.

Page 108: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 108

The implementations of the activity diagrams are finished now. Save the UML model.

The next step in the development process is to create or modify the component and deployment diagrams.

Page 109: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 109

8 Component and Deployment Diagrams

Note: We skipped the sequence diagram here, as it was already explained in lesson 1 and is only used for

documentation purposes.

Remember that component and deployment diagrams represent the physical view of the Web service.

A component diagram defines how components are wired together to form larger components or software systems. In

context of the Bridge you define composite services that are deployed to an E2E Server. The component diagram contains

model elements like components, classes, and interfaces. These model elements are manifested in artifacts.

Deployment diagrams define the execution architecture of systems and represent the deployment of (software) artifacts to

(hardware) nodes. A particular instance of an component artifact is deployed to a node instance, which means that the

composite service repository including optional definitions of required backends are copied to this specific machine.

In the picture below you see the initial situation, the component diagram of lesson 1. In the next modeling step, you will

rework the physical implementation of the Web service. The goal is to provide a second Web service running on the E2E

Server node instance localhost: The new SOAP service artifact GetProductServiceArtifact will be specified for the composite

service EducationLesson2.

After editing the component diagram, it will look like shown in the following picture.

The deployment diagram changes marginally, as only the name of the composite service artifact being deployed to

localhost will be changed.

Page 110: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 110

8.1 Reworking the Component Diagram

For reworking the existing component diagram you created in lesson 1, you will do some editing directly in the diagram

and use the E2E Components Wizard to create the new port type artifact.

In the containment tree, navigate to Data - Component View - EducationComponents and open the component diagram.

First, you will enter the new names of the composite service components.

Click the <<E2EComposite>> component

EducationLesson1 to select the UML symbol.

Page 111: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 111

Click the name of the component to edit it. Change

the name to EducationLesson2 and confirm the

change with Ctrl - Enter (pressing Enter only will

insert a new line).

You can also use the specification dialog to change

the name of a component. Double-click the

service component GetTitleService-Component

and change its name to GetProductService-

Component.

Close the dialog.

Now, you will edit the artifacts and assign new names. You also have to change the port number of the SOAP service

artifact, so both services (lesson 1 as well as lesson 2) can be run at the same time.

Page 112: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 112

Select the Service artifact EducationLesson1 and

switch to the Properties tab in the lower left

corner of Magic Draw (where the Model Compiler

is situated, too).

Change the name of the artifact to

EducationLesson2.

Change the Control Port number to 20012.

Page 113: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 113

Select the Service component artifact

GetTitleServiceArtifact in the diagram pane. In the

Properties tab, change it's name to

GetProductService-Artifact and change the Port to

10012.

Switch back to the E2E Model Compiler tab.

Next, you will substitute the old port type GetTitlePortType by the new port type GetProductPortType. First, you will delete

the old port type, then insert the new one.

Before you delete the port type class, you will first delete its corresponding port type artifact. Right-click the port type

artifact GetTitlePortTypeArtifact. Select Select in Containment Tree from the context menu.

The containment tree expands automatically and highlights the selected UML element.

Page 114: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 114

Press Del to delete the Artifact in the containment tree as well as the symbol in the diagram pane.

Note: Pressing the Delete-button in the containment tree deletes the definition in the containment tree and removes

all corresponding symbols from diagrams.

Note that the Artifact has been deleted from the diagram pane.

Right-Click on the port type GetTitlePortType and select it in the containment tree via the context menu. Then, select the

graphical symbol on the diagram pane.

Press Ctrl - D to delete the symbol and the port type definition in the containment tree.

Page 115: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 115

Note: Pressing the Delete-button only deletes the symbol on the diagram pane. Pressing Ctrl - D deletes both: the

symbol and the definition in the containment tree.

The component diagram now should look as follows:

Page 116: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 116

8.2 Using the E2E Components Wizard

Start the E2E Components Wizard by clicking on the icon in the diagram toolbar on the left.

Note: You need to click the icon Edit Component Diagram in the diagram toolbar and not the icon E2E Components

Wizard in the menu bar in order to edit an existing component diagram.

The E2E Components Wizard dialog window opens.

The wizard displays the Service Components

EducationLesson2 and the composite artifact

EducationLesson2.

Page 117: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 117

Expand the tree on the left and navigate to the

component GetProductService-Component below

the Components node of the tree.

In the SOAP Port Type list, all available port types are listed. As you already deleted GetTitlePortType, GetProductPortType

is the only available port type.

Select GetProductPortType and click > to

create an artifact.

Page 118: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 118

Click OK for confirmation.

In the Customized Artifacts part of the tree panel,

the configuration artifact is selected again, to give

you the option to define further frontend services.

As you do not need any further elements, click

Skip.

Page 119: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 119

All necessary components and artifacts have

been defined. As you do not define any backend

or proxy in lesson 2, choose the option Finish to

continue with the last step.

This is the final step of the Components Wizard.

You need to confirm drawing the component

diagram.

If components and artifacts are not complete yet,

you may select an element node in the tree panel

and add further UML elements to the diagram.

Click Finish .

As of changing the component diagram, some

data needs to be reloaded by the Model Compiler.

Click Yes to refresh the deployment data and

save the UML model.

The component diagram will be drawn in MagicDraw. The defined components and artifacts are saved in the package Data

/ Component View.

The generated component diagram will open. Remember that re-routing the paths is possible via Route Paths

Orthogonal Style from the diagram toolbar.

Page 120: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 120

The deployment diagram shown below has changed automatically, when you renamed the Composite Service artifact. The

artifact instance (a copy of the Composite Service artifact EducationLesson2) will be deployed to node instance localhost.

Page 121: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 121

Now, the Composite Service EducationLesson2 can be compiled again.

Note: Whenever changes are made in the component or deployment diagrams without using the Components or

Deployment Wizard (e.g. modifying tagged values manually), you must save the UML model. This will trigger an

automatic refresh of the deployment data.

Page 122: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 122

9 Compilation

The modeling phase of the extended Web Service has been completed. Now, you can compile and deploy the UML model.

Then, you can test the deployed Composite Service with the E2E Model Debugger and use it with the Excel client

afterwards.

Two UML model files are displayed in the

Model Compiler window.

In the deployment view of the Model Compiler

window, expand the file lesson2.xml to compile

the Composite Service EducationLesson2

respectively its deployment.

Page 123: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 123

While E2E Builder for MagicDraw is compiling,

the Working… window will be displayed.

It could be possible that the example was not compiled without errors. In this case, the Composite Service

EducationLesson2 would have turned red. In the following chapter, it will be explained, how to solve such a problem.

Page 124: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 124

9.1 Solving Errors

If the Model Compiler reports an error, it tells you what problem was found. It will also guide you to the location in the

containment tree, where the error occurred.

The Model Compiler shows all error messages in the E2E Messages window and in the tree of the deployment view below

the deployment of the Composite service. Refer to the chapter Solving Errors in lesson 1 for a detailed explanation of how

to trace errors.

If you find no way to fix possible problems in your lesson 2 model, you can use the solution model of lesson 2 as a

reference.

Open the Builder project E2E Education

(default location C:\E2EBridgeDocumenta-

tion_5\E2EBuilderProjects).

Select the Builder project and click OK.

Page 125: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 125

If you have not opened this project before, the

E2E Builder File Chooser pops up. Select the file

lesson2.xml in sub folder uml, which contains all

reference models of this course with complete

solutions.

If you already studied the solution models in lesson1, the builder will automatically open the model file last used, in this

case probably lesson1.xml.

Close the project lesson1.xml.

Open the E2E Builder menu and select Open E2E

Model > lesson2.xml.

Page 126: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 126

You can compare the solution model with your

model to find the error.

Switch between open project files using the

Opened Projects toolbar of Magic Draw.

Note: By loading lesson2.xml from Builder Project E2E Education your own project Education is no longer the active

Builder project, though your own XMI file lesson2.xml is held open within Magic Draw. Wanting to continue working

with Education, you will have to reopen the project.

Finally, return to your own model. Close the

solution project using the MagicDraw menu

items File > Close Project (select the solution

model first).

Remember, that in MagicDraw a project is a

model file and should not be mixed up with a

Builder project.

Switch the Builder project again. Select E2E

Builder > Reopen and choose your Builder

project (Education) from the list.

Note the change in the MagicDraw title bar.The

Builder project name has changed back to

Education.

As an alternative, you can continue your studies with the solution model by importing the solution into your own Builder

project.

Page 127: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 127

Select the menu item Import > XMI File from

the Compiler Window's menu.

The File Chooser pops up. Change to the Builder

project E2E Education and double-click the folder

uml.

Page 128: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 128

Choose lesson2.xml, as you want to import the

solution model of lesson 2 and click OK.

Now define the destination of the imported model.

The default folder is the uml folder of the current

Builder project. Change the file name to e.g.

lesson2_solution.xml and click OK.

The imported model will be listed in the

deployment view of the Model Compiler. You

could compile this model and continue with it to

the end of lesson 2.

Page 129: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 129

10 Testing with E2E Interactive Debugger

R

emember that the E2E Interactive Debugger allows you to debug models at runtime.

For detailed information see the E2E Builder User Guide.

Page 130: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 130

10.1 Checking the Services properties

With the right mouse button click

EducationDeployment in the Deployment View

of the Model Compiler and select Properties

from the context menu.

Switch to the Global Settings Tab. The setting exchange rate CHF - USD you defined within the action script of Get

Exchange Rate is displayed with its initial value.

The exchange rate may be changed here before starting the service.

Page 131: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 131

10.2 Running the Service

Select Run "EducationDeployment" from the

deployments context menu.

The Runtime window shows the service having been

deployed to the internal server of the development

environment and now running in the E2E Embedded

Server.

Remember that using the Embedded Server,

divergent deployment defined in the deployment

diagram is ignored - the service will always be

deployed to localhost.

The service is running now and can be tested with the E2E Model Debugger.

Page 132: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 132

10.3 Running a Test Case

Click Open Test Case in the Runtime window to switch to the E2E SOAP Test Tool in tab Test Cases..

The automatically created test case getProduct is displayed. It is marked with a gearwheel . The gearwheel in gray color

indicates that the test case has not yet been run. On the Request tab in the right panel, both input parameters inputTitle

and inputProductRecord are displayed. Behind each parameter name, the type and the assigned value are displayed.

Initially, the parameters are set to null.

The symbol indicates a parameter of complex type, the symbol a string.

Create the parameter inputProductRecord, which is of complex type. Remember, that parameters of complex type have to

be created by a create-statement.

Click it with the right mouse button and select Create.

Page 133: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 133

Expand the parameter inputProductRecord in order to open its attributes.

Enter input values in the Request tab as shown below.

Run the test case.

If the test case reports no error, a green gearwheel will be displayed in front of the test case name. The Model

Debugger switches to the Response tab and shows the result.

Page 134: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 134

Expand the output object outputProductRecord to inspect the response of the Web Service.

The output objects outputProductRecord and outputTitle have been returned after calling the operation getProduct of the

Composite Service EducationLesson2.

The object outputTitle is a string and was reused from lesson 1.

All attributes of your input data are shown in the output object outputProductRecord . Note, that the value of the

exchangeRate is also being displayed. It was set in the activity diagram Set Price CHF and Exchange Rate. The price in CHF

was also calculated as defined in the action script.

Page 135: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 135

10.4 Stepping through the Model with the E2E Interactive Debugger

In this chapter, you are going to step through the lesson 2 model with the E2E Interactive Debugger to recall the features

of the debugging tool.

Start the service in debug mode. If you do not stop the running service before, the runtime will stop the service and restart

it in debug mode.

You can either select Debug

"EducationDeployment" from the context

menu of EducationDeployment in the

Deployment View of the Model Compiler, or

...

... switch to the Debug tab in the Runtime

window and click the button .

Page 136: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 136

If the service is still running, you may also

switch to the Run tab and click the selector

button there.

The service will switch to debug mode without

restarting.

The icon of the button changes to a stop symbol

and stays in activated mode. To turn of

debug mode, just click this button again.

After starting the service in debug mode, the Runtime window switches to the Debug tab and shows the debugger waiting

for commands.

Page 137: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 137

Click the pause button . The interactive debugger will pause the service at the next possible point: if the test case has

not been started yet, this means the very first action of the service.

Click Open Test Case to switch to the Test Cases tab. You can see the test case getProduct and its test case data. As you

have run the test case before, the test case's gearwheel is green.

Run the test case again.

Page 138: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 138

The Runtime window switches back to the Debug tab and the service has been paused on its first activity Get Title.

Click Step into .

Page 139: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 139

In the watches part in left panel of the debug window, you can see the input values. In the right panel, the debugger

displays the action script statement highlighted that will be executed next: set outputTitle =

inputTitle.toUpper();

Click Step Into .

Page 140: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 140

In the watches panel note the additional object outputTitle that was created by the action script statement. It contains the

value of inputTitle converted to upper case.

As the action script contained only one statement and there were no further statements to step into, the step into

command resulted in switching to the next action node Map Product Record Data.

Click Step Over as it is not possible to step through the mapping statements.

Note: Clicking Step Into in cases when it is not possible to step into or through an action script, the debugger

automatically uses the corresponding possible command, e.g. Step Over or Go Up .

The watches panel displays the mapped data in outputProductRecord. In the activity diagram of activity Get Title the debug

focus switched to the call operation action getExchangeRate.

Click Step Into .

Page 141: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 141

The call operation action getExchangeRate was implemented in activity diagram Get Exchange Rate. As you stepped into

the call operation action, the debugger switched to the corresponding activity diagram in the diagram pane.

In the script panel of the debug window, note the action script statement to be executed next.

Click Step Into twice - first to step into the action node and second to execute the action script statement.

Page 142: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 142

The debugger pauses on the activity final node and displays the result of the action script statement.

Click Step Into or Go Up . The debugger will go up to the caller activity diagram and wait on the next action node.

Page 143: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 143

Click Step Over .

Page 144: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 144

The debugger pauses on the activity final of the activity diagram.

Resize the watches panel to have a better look at the displayed objects. Move the mouse cursor over the line separating

the watches and the script part of the debug window. Drag the separator to the left until you can see all object values.

Click Go To Next Breakpoint . As you set no breakpoints in the model, the service runs to its end.

Page 145: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 145

10.5 Requesting the Web Service with the Excel Client

The Excel client Client-lesson2.xls is provided

with the E2E Documentation.

You will find the Excel spreadsheet in the documentation location (default location:

C:\E2EBridgeDocumentation_5\Documentation\pdf\E2E Education\Lesson2). Double-click the file to start the Excel

application.

If you did not add the E2E Bridge

Documentation folder to your trusted locations

in lesson 1, the spreadsheet containing macros,

Excel will throw a security warning.

Click Options... and choose Enable this

content in the appearing window to be sure

that the macro enhancements will be loaded

when the spreadsheet is opened.

Note: If necessary, you should adjust the security settings in Excel in order to allow running macros (e.g. in Excel

2007, see Macro Security in the Developer tab).

Page 146: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 146

In the Excel dialog that has been opened,

switch to the tab Preferences. Enter the title

that should be displayed in the Excel

spreadsheet.

The E2E Composite Service URL path specifies,

on which node instance the Composite Service

is running. The path is equivalent to the path of

the port type in the containment tree of

MagicDraw: http://localhost:10012/ Services/

GetProductService/Ports/

GetProductPortType.

Change to the tab Search Parameters. You may

overwrite the suggested values displayed in the

input mask. Enter the values that should be

displayed in the first product data row of the

Excel spreadsheet and click Search .

The data you have entered has been sent to the

Web Service. After processing the data (currency

calculation), it has been returned to the Excel

client. The chosen title and the product record are

displayed in the spreadsheet.

Note, that like in the Trace Analyzer, the exchange rate and the calculated price in CHF are displayed.

Page 147: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 147

11 E2E Server and E2E Console

In the lessons of E2E Education the services are run with the embedded server on server localhost. With E2E Server

including E2E Console you have the possibility to deploy to, run and administer services on multiple platforms.

If you have licensed the E2E Server, you already installed E2E Server used E2E Console to manage the Composite Service

of lesson 1. Now, you may deploy and check the Composite Service of lesson 2. Otherwise skip this chapter and continue

with lesson 3.

Page 148: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 148

11.1 Deploying the Compiled Composite Service

Before you deploy the compiled Composite Service, check the settings of the Builder project. Select E2E Builder > Settings

from the menu. On the tab Model Compiler, the deployment settings of your project should be set as follows:

Deploying E2E Console Name localhost (if you have a Workstation mode installation, otherwise, enter

the name of the server

Deploying E2E Console Port 8080 (defined during installation of E2E Server)

User admin

Run Startup Configuration after

Deployment

checked

Overwrite Existing Service

Configurations

checked

Select OK to close the window, return to the Model Compiler window, and select the Composite Service.

Stop the service, which is still running in the

embedded server, by selecting Stop "Education

Deployment" from the context menu.

Page 149: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 149

Click the right mouse button and select Deploy

“EducationDeployment”.

Enter the password for user admin in the console

password dialog and click OK.

The Untrusted Certificate dialog should not pop up, as you already deployed lesson 1 via this console and clicked Trust &

Continue then.

Wait, while deployment process is in progress.

Page 150: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 150

If the deploying Console name defined in the

Builder project settings does not match to the

domain name registered on the Console

certificate, the message shown below is displayed.

Click the Continue button to deploy the Composite

Service to the Server.

The picture below summarizes the whole process, from modeling a Service to its deployment to a Server. It shows an

example for running a productive and a test Composite Service on the same node instance localhost.

Page 151: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 151

11.2 E2E Console

You now may check the Composite Service deployed to the node instance localhost. Start a Web browser and enter the

following URL in the address field to access the Console: https://localhost:8080/admin.

Expand the node localhost in the tree. Expand the entry Bridge Server and the category E2E Education to see all deployed

Composite Services.

You will find the running Composite Service EducationLesson2 sorted below category E2E Education as is also

EducationLesson1.

Clicking the hypertext link Bridge Server, all deployed Composite Services running on this node instance will be displayed

in the working panel. You can start, stop, and delete them, and view their logs by using the appropriate buttons. You must

stop a Composite Service prior to deleting it.

Click on the Composite Service EducationLesson2 in the navigation tree on the left to see the details of the Composite

Service. It is currently running and has a SOAP service listening on port 10012.

Page 152: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 152

Further information can be viewed on the tabs Configuration, History, Logging, Settings, Version, and Persistent State.

The Start button is disabled, if the Composite Service is already running. The Composite Service preferences can only be

changed when the Composite Service is stopped.

Switch to the Settings tab.

Page 153: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 153

After stopping the Composite Service the defined setting exchange rate CHF - USD may be changed here.

If you would like to read a more about E2E Console, we recommend reading the E2E Server User Guide.

Page 154: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 154

12 Testing with E2E Analyzer

Remember that E2E Analyzer is the interface to the trace feature, with whom you can test all operations on the fly. It traces

the execution path of a service that is run through the test. You may view this path graphically, e.g. in order to debug web

services or verify their correct functioning. Each operation defined on a port type can be tested with this tool. It makes no

difference wether the service is running in the E2E Embedded Runtime or has been deployed to a server.

For detailed information see the E2E Builder User Guide.

Page 155: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 155

12.1 Starting the Service and the Analyzer

Start the education service of lesson 2 in the

Embedded Runtime.

After the service is running, minimize MagicDraw and start the E2E Analyzer from your desktop .

The empty Analyzer window is displayed.

Page 156: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 156

Page 157: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 157

12.2 Opening a Builder Project

First, open the Builder Project you want to test services from - in this case Education.

Select Project > Open E2E Builder Project.

The E2E Builder File Chooser pops up. Navigate

to the Builder Project Education within your

Builder Projects directory (e.g. BuilderProjects >

Education).

Select Education and click OK.

Page 158: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 158

As you can see in the title bar of the Analyzer, the

project Education has been opened. In the Trace

Analyzer tab of the Analyzer the two

deployments, you already created test cases for

in lesson 1 and 2, are displayed.

Alternatively, you could also import additional

web service definitions by selecting one of the

options from the Import menu.

During the compilation process, the Model

Compiler produced the repository file containing

the executable Web Service. It also created the

WSDL file describing the Web Service in the Web

Service Definition Language.

These WSDL files can be imported into your Builder project and - if it concerns an E2E Bridge Service - be tested like

described below.

Expand the tree of the lesson2 deployment lesson2.EducationLesson2.EducationDepoyment. The structure of the tree

corresponds to the tree structure in the E2E SOAP Test Tool which is part of the Runtime window:

1. identifier of the WSDL definition (deployed

composite service)

2. name of the service

3. name of the port type

4. name of the operation

5. name of the test case

Page 159: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 159

Note: The E2E Soap Test Tool and the E2E Analyzer are sharing the same test case definitions. Test cases

already defined in the SOAP Test Tool can also be run in the Analyzer an vice versa.

You can see the request and response log from the earlier running of the test case with the Interactive Debugger.

Page 160: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 160

12.3 Test Case Properties

Click the test case getProduct.

In the left panel of the Analyzer window an additional tab UML appears, saying "This test case has not been run yet with

trace enabled.". This is correct as this test case has been created and run within the SOAP Test Tool and not within the

Analyzer.

Select Properties from the test case's context

menu.

Page 161: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 161

The properties dialog of the test case contains

three tabs. The two tabs General and HTTP

Header contain the same information as the

corresponding tabs in the Interactive Debugger.

Switch to the additional Trace tab.

Check the option Full Trace.

Click OK.

Run the test case again to collect the trace

information.

Page 162: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 162

12.4 Tracing through the Service

Switch to the UML tab.

A graphical debugging tool starts up, which helps you to follow the trace of the executed action flow. You can see a

sequence diagram created by the server at runtime. It displays the actions executed by the web service.

The sequence diagram has sensitive areas. By clicking and holding an object, you can drag and drop it.

Move the mouse over the SOAP operation getProduct on the arrow pointing to the right and click the right mouse button.

Select Show parameters. The input runtime value

of the getProduct SOAP operation will be shown

in the Watches list in the lower panel.

Page 163: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 163

Right clicking return on the response arrow pointing to the left and selecting Show parameters you can see the runtime

value of the output object returned by the SOAP operation in the Watches panel as well.

Now, double-click the operation name getProduct.

Page 164: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 164

If you set the Trace option before you compiled the composite service and set the trace level to Full trace in the test case

properties the picture below appears. It shows the activity diagram that was assigned to the SOAP operation in the UML

model.

Page 165: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 165

Double-clicking mouse-sensitive items, more runtime information generated during the execution of the model will be

displayed. For example, double-click the action node Get Title to open the action script in the E2E Action Script Viewer. The

Action Script Viewer shows action script with all runtime values.

Page 166: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 166

Underlined variable names within the Action Script Viewer indicate that actual runtime data can be viewed. Click inputTitle

to open the Text Viewer, which shows the value Price Comparison.

Page 167: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 167

Navigating this way, you can browse through different levels of the UML diagram. Note that in the tree panel on the left, the

corresponding UML elements are highlighted.

To trace through the model you can also navigate through the test case trace in the tree panel on the left. For instance,

expand the action node getProduct and click the activity diagram node Map Product Record Data. The activity diagram

opens in the UML tab.

Page 168: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 168

Map Product Record Data contains a call of the mapping macro implemented by the <<Mapping>> stereotype. This activity

diagram was generated by the Analyzer and is therefore displayed with a gray background.

Double-click standard mapping to inspect the underlying action script.

On the left you can see the set-statements the

compiler generated form the <<Mapping>>

stereotype.

Defining the data mappings between in- and output attributes with set assignment statements within action script often

leads to a huge modelling and scripting effort.

Page 169: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 169

E2E Bridge offers you a powerful and more convenient alternative. The attribute mappings are defined directly in a class

diagram by drawing dependencies between the attributes of the involved classes. It is possible to create complex rules for

the attribute mapping by defining the mapping rules on the <<E2ESimpleMapping>> stereotyped dependencies. For even

more complex rules, for example if you have to do a look-up in a database, you can specify a <<E2EMappingHandler>>

class.

The <<Mapping>> action then will internally translate all these declarations defined in class diagrams into activity

diagrams with the needed set statements, decisions and iterations.

That is why this approach reduces your scripting and modelling effort significantly. Furthermore, you keep the attribute

mappings maintainable, because they are not hidden in the action script, but are well documented in the class diagram.

Page 170: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 170

13 Glossary

E

E2E Action Language: (EAL)The E2E Action Language implements parts of the Action Semantics UML Extensions.

E2E Bridge® x.x: (Bridge)The whole E2E Bridge platform containing the development and test tools and the server

sofftware (x.x stands for the version number e.g. E2E Bridge® 5.0).

E2E Builder: (Builder)The Builder optimizes and compiles XMI files to an executable E2E Composite Service.It contains E2E

Model Compiler and E2E Model Debugger.

E2E Composite Service: (composite service) The compiled composite service deployed to an E2E Server. It contains the

internal representation of a service (load and performance optimized for the E2E Runtime).

E2E Console: (Console) The Web-based administration user interface for managing E2E node instances, E2E Server

domains, and E2E Composite Services.

E2E Runtime: (Runtime) The C++ kernel, which executes the compiled UML model (provides for instance the in/out SOAP

messages that are necessary to fulfill Web Service calls).

E2E Server: (Server) The whole E2E Server software containing E2E Runtime and E2E Console.

E2E Server node instance: (node instance) A physical machine, on which an E2E Server runs.

H

HTTP: The HyperText Transfer Protocol is the protocol of the Web, by which servers and clients (typically browsers)

communicate. An HTTP transaction comprises a request sent by the client to the server, and a response returned

from the server to the client.

M

Model Driven Architecture®: (MDA®) Separating abstract model from implementation issues to enhance reuse.

S

Server domain: (domain) Aggregation of E2E node instances, which are managed with the E2E Console.

Simple Object Access Protocol: (SOAP) The Simple Object Access Protocol is the message protocol that allows Web

services to talk. SOAP is an XML-based protocol for exchanging information between computers. Although SOAP

can be used in a variety of messaging systems and can be delivered via a variety of transport protocols, the main

focus of SOAP is on Remote Procedure Calls (RPC) transported via HTTP. SOAP is platform independent, and

therefore enables diverse applications to communicate with each other.

Stereotype: A UML extension mechanism, which looks like <<SQL Adapter>>. This adds a special meaning to a UML object.

T

Tagged value: A UML extension mechanism that enhances standard UML objects with additional attributes. For instance, a

tagged value named 'DB name' can be defined for an SQL Adapter.

Page 171: E2E Bridge Education Lesson 2

Education Lesson 2

© 2012 E2E Technologies | www.e2ebridge.com | 171

U

Unified Modeling Language™: (UML) The Unified Modeling Language (UML) helps you to specify, to visualize, and to

document models of software systems, including their structure and design, in a way that meets all of the

application's requirements. You can use UML for business modeling and modeling of other non-software

systems, too.

Universal Description, Discovery and Integration: (UDDI) A database that holds technical and non-technical information

about services. Used to find a service and its corresponding WSDL definition.

W

Web Service: A Web service is any piece of software that makes itself available over the Internet and uses a standardized

XML data format. XML is used to encode all communications to a Web service. For example, a client invokes a

Web service by sending an XML message, and then waits for a corresponding XML response. As all

communication is in XML, Web services are not tied to any one operating system or programming language.

Thus, they work like a middleware that enables and simplifies application-to-application connectivity.

Web Service Definition Language: (WSDL) The Web Service Description Language is an XML grammar that allows a Web

service to describe what it can do, what messages it accepts, and what response it returns.

X

XML: XML is a markup language for documents containing structured information. It is a meta-language for describing

markup languages. In other words, XML provides a facility to define tags and the structural relationships between

them. It is being optimized and designed to deliver structured content over the web and supports a wide variety of

applications.

XML Metadata Interchange: (XMI®) The XML Metadata Interchange Format is an exchange format for UML models. It

standardizes the representation of UML models in XML.